Skip to content

Add hourly background refresh for stored weather data - #332

Merged
Carpenteri1 merged 6 commits into
sandboxfrom
hourly-weather-refresh
Aug 9, 2026
Merged

Add hourly background refresh for stored weather data#332
Carpenteri1 merged 6 commits into
sandboxfrom
hourly-weather-refresh

Conversation

@Carpenteri1

Copy link
Copy Markdown
Owner

Adds a BackgroundService that re-fetches weather for every stored address once per hour via the existing GetVisualCrossingDataQuery / SaveWeatherCommand pipeline, so cached data stays warm without waiting on a client request.

Carpenteri1 and others added 3 commits August 7, 2026 13:31
Adds a BackgroundService that re-fetches weather for every stored
address once per hour via the existing GetVisualCrossingDataQuery /
SaveWeatherCommand pipeline, so cached data stays warm without
waiting on a client request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The background service was calling GetVisualCrossingDataQuery through
the mediator directly, bypassing the "weather" token-bucket policy
that's only enforced on the HTTP endpoint. With more than one stored
address it would burst-call the provider well past its configured
limit. Space calls out using the same WeatherRateLimiterModel values
so the job never exceeds what the endpoint itself would allow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Exposes RefreshAll and the provider-call delay as internal so tests
in the same assembly can exercise them directly, following the
handler-test pattern already used elsewhere. Adds FakeMediator and a
current FakeWeatherRepository test double (the old one in
TestDoubles.cs was commented out and targeted a stale IWeatherRepository
shape, so it's replaced rather than left dangling). Covers: no stored
addresses, a successful refresh setting CardId before save, a
non-OK provider response not triggering a save, one address throwing
without blocking the rest, and calls being spaced out per address.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Carpenteri1 Carpenteri1 linked an issue Aug 8, 2026 that may be closed by this pull request
@Carpenteri1
Carpenteri1 merged commit fa4e833 into sandbox Aug 9, 2026
7 checks passed
@Carpenteri1
Carpenteri1 deleted the hourly-weather-refresh branch August 9, 2026 13:06
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.

Refresh weather data

1 participant