Fix frozen Yr weather-module#3706
Merged
Merged
Conversation
updateAvailable must be called to schedule the next update. If we just return or throw an error the fetch-methods will not be called from weather.js.
If the forecast is fetched from the cache we should remove the entries that no longer provide any value to the user.
This is probably due to a HTTP 429 (Too many requests). If the MagicMirror is throttled we should fall back to the cached data.
Collaborator
can confirm this, so we live with the error message instead. Or may @rejas has an idea how to change |
khassel
approved these changes
Jan 26, 2025
Collaborator
|
after some digging in the code I found in WeatherProvider.initialize = function (providerIdentifier, delegate) {
const pi = providerIdentifier.toLowerCase();
const provider = new WeatherProvider.providers[pi]();
const config = Object.assign({}, provider.defaults, delegate.config);
provider.delegate = delegate;
provider.setConfig(config);
...which explains the behavior. So I tested |
Some users get HTTP 429 from the API. This indicates too many request. In the terms of service, yr says "don't make more than one poll every 10 mins". We now increase the updateInterval-value to 600000 if a smaller value is set by the user.
37378b3 to
dc090c6
Compare
khassel
approved these changes
Jan 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3296
The problem was that the fetch-methods threw errors when something went wrong instead of calling
updateAvailable().updateAvailable()must be called in order to schedule the next update.I added some filtering for the hourly forecast that removes hours in the past. If the API call fails we use the cached data, but we should only display hours in the future.