fix: skip weather fetch during geocode backoff#125
Conversation
mattrossman
commented
Apr 3, 2026
- Short-circuit fetches while geocode cooldown is active so they never count as attempts
- Prevents minute-by-minute telemetry spam from backoff-only skips
There was a problem hiding this comment.
Pull request overview
This PR short-circuits weather fetches when the geocoding subsystem is in a 429 backoff window, so those skips don’t count as fetch attempts and don’t generate repetitive telemetry.
Changes:
- Added a
WeatherProvider.prototype.isGeocodeBackoffActive()helper to expose the geocode backoff state. - Updated
fetch()insrc/pkjs/index.jsto return early when geocode backoff is active.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/pkjs/weather/provider.js | Adds a provider-level helper to report whether geocode backoff is active. |
| src/pkjs/index.js | Skips weather fetch (and therefore attempt counting/telemetry) while geocode backoff is active. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // GPS mode and empty overrides never forward a location string to LocationIQ. | ||
| if (typeof this.location !== 'string' || this.location.trim().length === 0) { | ||
| return false; | ||
| } | ||
|
|
||
| // Raw lat/long overrides bypass forward geocoding entirely. | ||
| if (r_lat_long.test(this.location.trim())) { | ||
| return false; |
There was a problem hiding this comment.
isGeocodeBackoffActive() treats a lat/long override with leading/trailing whitespace as “raw coordinates” by testing against r_lat_long on this.location.trim(). However withGeocodeCoordinates() later does this.location.match(r_lat_long) without trimming, so the same value (e.g. " 47.6, -122.3 ") won’t be recognized as coordinates and will fall through to forward geocoding (and then hit backoff / count as an attempt). To keep the skip logic consistent with the actual geocode path, trim before matching in withGeocodeCoordinates() or update r_lat_long to accept leading/trailing whitespace (and then use the same normalized value everywhere).