Skip to content

Commit 37378b3

Browse files
committed
Added check to make sure the update interval is at least 10 minutes
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". I wanted to change the config instead of crashing the module, but the setInterval was still called with the original value.
1 parent b57c68c commit 37378b3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ planned for 2025-04-01
2121
- [core] Optimize systeminformation calls and output (#3689)
2222
- [core] Add issue templates for feature requests and bug reports (#3695)
2323
- [core] Adapt `start:x11:dev` script
24+
- [weather/yr] The Yr weather provider won't start with a `updateInterval` below 600000 ms (10 minutes) in order to meet the terms of service.
2425

2526
### Removed
2627

modules/default/weather/providers/yr.js

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ WeatherProvider.register("yr", {
2323
Log.error("The Yr weather provider requires local storage.");
2424
throw new Error("Local storage not available");
2525
}
26+
if (this.config.updateInterval < 600000) {
27+
Log.error("The Yr weather provider requires an update interval of minimum 10 minutes (600 000ms).");
28+
throw new Error("Update interval too short");
29+
}
2630
Log.info(`Weather provider: ${this.providerName} started.`);
2731
},
2832

0 commit comments

Comments
 (0)