Skip to content

Recover weather sooner, and say when it isn't for where you are - #37

Open
edward-mcnair wants to merge 2 commits into
kemalandic:mainfrom
edward-mcnair:weather-resilience
Open

edward-mcnair wants to merge 2 commits into
kemalandic:mainfrom
edward-mcnair:weather-resilience

Conversation

@edward-mcnair

@edward-mcnair edward-mcnair commented Oct 12, 2026 •

Copy link
Copy Markdown

What does this PR do?

A failed fetch, such as one at wake that runs before Wi-Fi joins, left the error on screen for the full 15-minute refresh. A missing location silently showed London.

  • Retries after 30 s, 2 min and 5 min, then the regular refresh takes over.
  • Fetches again as soon as the network comes back (NWPathMonitor) after a failure.
  • Fetches again as soon as location is allowed, in the prompt or in System Settings. A fallback isn't a failed fetch, so before this the tile kept showing London until the next 15-minute refresh.
  • Uses your last known location before falling back to London. The tile says which ("Last known location", "London (location off)"), and when it's showing an earlier reading offline.
  • LocationProvider is now main-actor isolated, since its delegate callbacks arrive on main; it was @unchecked Sendable with unsynchronised continuation access.
    • A request times out after 15 s, resumes its continuation exactly once, and ends when its fetch is cancelled.
    • Callbacks queued after the service stops do nothing.

Tests: WeatherRetryTests, covering the retry schedule.

Screenshots

A small caption in the corner of the Weather tile, only when the reading is offline or from a fallback location.

Checklist

  • Tested on macOS 14+ (macOS 27)
  • No third-party dependencies added
  • Follows existing code style (swift-format lint clean)

🤖 Generated with Claude Code

edward-mcnair and others added 2 commits October 12, 2026 10:01
A failed fetch (a fetch at wake that runs before Wi-Fi joins, say) left the
error on screen for the full 15-minute refresh, and a missing location
silently showed London.

- Retries after 30 s, 2 min and 5 min, then the regular refresh takes over.
- Fetches again as soon as the network comes back (NWPathMonitor) after a
  failure.
- Uses your last known location before falling back to London, and the tile
  says which ("Last known location", "London (location off)") and when it's
  showing an earlier reading offline.
- LocationProvider is main-actor isolated (its delegate callbacks arrive on
  main); a request times out after 15 s, resumes its continuation exactly
  once, and ends when its fetch is cancelled. Callbacks queued when the
  service stops do nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fallback location isn't a failed fetch, so nothing retried it: after you
allowed location (in the prompt or System Settings) the tile kept showing
London until the next 15-minute refresh. LocationProvider now reports
authorization changes, and the service fetches again straight away while
it's showing a fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant