Skip to content

fix: skip weather fetch during geocode backoff#125

Draft
mattrossman wants to merge 3 commits intomainfrom
fix/backoff-telemetry-gate
Draft

fix: skip weather fetch during geocode backoff#125
mattrossman wants to merge 3 commits intomainfrom
fix/backoff-telemetry-gate

Conversation

@mattrossman
Copy link
Copy Markdown
Owner

  • Short-circuit fetches while geocode cooldown is active so they never count as attempts
  • Prevents minute-by-minute telemetry spam from backoff-only skips

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() in src/pkjs/index.js to 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +182 to +189
// 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;
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants