Closed ferdnyc closed 4 months ago
Journal logs of the "storm":
I've been running with these configs for a few minutes now, I don't have any weather because both APIs are rate-limited, but at least I don't have storms of retries either.
I see what you did but it shouldn't have even ever tried the same API server twice, so it should loop through every one then just notify at the end saying "I tried them all but none of them worked." (Obviously that isn't what it is doing right now so that is the bug.) Thanks for trying to fix it though. I will ship a fix soon.
@penguin-teal
it should loop through every one then just notify at the end saying "I tried them all but none of them worked."
That makes sense, but I still think that resetting the interval of the timer, after it's fired with a custom timeout, is a good idea.
The problem with telling it to retry in 1 second (or 10 seconds, or whatever) is, if the callback function returns true
(which it currently always does), that will now be the new interval and the timer will repeat at that frequency indefinitely.
@ferdnyc I was interpreting the word "timeout" as it is used in JavaScript, but obviously GLib isn't at all related and I thought it was essentially a wait/delay to postpone an action when I read that and not a repeating timer interval. However, the way I went about fixing it was instead to always delete the interval after and then restart it with the default timespan ( ea129635966c97deed1bd37bb8f7eaca704da7f2 ). I didn't write this function and just from the name it implies that it has a one-time effect, and so I've fixed it to reflect that.
Also the reason it is a 1 second retry time is because it waits 1 second to ping a completely different server, cycling through every provider.
Just wanted to let you know that you were onto something.
reloadWeatherCurrent()
that, if set, will be the interval that's set to the timer after the current interval next expires. (This is so that short-interval retries will occur only once, and the normal timer period restored after.)