Skip to content

Commit

Permalink
Added check to make sure the update interval is at least 10 minutes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MagMar94 committed Jan 27, 2025
1 parent b57c68c commit dc090c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ planned for 2025-04-01
- [core] Optimize systeminformation calls and output (#3689)
- [core] Add issue templates for feature requests and bug reports (#3695)
- [core] Adapt `start:x11:dev` script
- [weather/yr] The Yr weather provider now enforces a minimum `updateInterval` of 600 000 ms (10 minutes) to comply with the terms of service. If a lower value is set, it will be automatically increased to this minimum.

### Removed

Expand Down
4 changes: 4 additions & 0 deletions modules/default/weather/providers/yr.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ WeatherProvider.register("yr", {
Log.error("The Yr weather provider requires local storage.");
throw new Error("Local storage not available");
}
if (this.config.updateInterval < 600000) {
Log.warn("The Yr weather provider requires a minimum update interval of 10 minutes (600 000 ms). The configuration has been adjusted to meet this requirement.");
this.delegate.config.updateInterval = 600000;
}
Log.info(`Weather provider: ${this.providerName} started.`);
},

Expand Down

0 comments on commit dc090c6

Please sign in to comment.