Skip to content

fix(electricity): surface NordPool warnings and refresh today+tomorrow on daily run#114

Merged
sondresjolyst merged 5 commits intodevelopmentfrom
fix/electricity-fetch-logging-and-daily-refresh
Apr 23, 2026
Merged

fix(electricity): surface NordPool warnings and refresh today+tomorrow on daily run#114
sondresjolyst merged 5 commits intodevelopmentfrom
fix/electricity-fetch-logging-and-daily-refresh

Conversation

@sondresjolyst
Copy link
Copy Markdown
Owner

Problem

The ElectricityPriceFetchService background job was failing silently:

  • NullLogger was passed to NordPoolService, so parse warnings (e.g. entryPerArea not found) were completely swallowed.
  • If NordPool returned a parseable response with 0 entries, the service logged success while storing nothing.
  • The daily 14:00 UTC refresh only fetched tomorrow's HOURLY prices. A single missed run created a permanent gap for the current day until the pod was manually restarted.

This caused automation rules to fail fetching electricity prices (GET /api/electricity/current-price returning 404).

Changes

  • Replace NullLogger with ILoggerFactory.CreateLogger() so NordPool warnings/errors are visible in pod logs.
  • Add guards for empty Areas and empty Values with explicit WRN log messages.
  • Log the actual count of stored entries on success.
  • FetchDailyRefreshAsync now fetches today + tomorrow HOURLY (previously only tomorrow).

sondresjolyst and others added 5 commits April 19, 2026 21:23
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…w on daily run

- Replace NullLogger with real ILoggerFactory logger in ElectricityPriceFetchService
  so NordPool parse warnings (e.g. missing JSON keys) are visible in pod logs instead
  of being silently dropped.
- Add explicit guards for empty Areas and empty Values in FetchAndStoreAsync, logging
  a WRN instead of silently completing with 0 rows stored.
- Log the actual count of stored entries on success for easier observability.
- FetchDailyRefreshAsync now fetches both today and tomorrow HOURLY prices (was
  only tomorrow), so a single missed scheduled run no longer creates a permanent
  data gap for the current day.
@sondresjolyst sondresjolyst merged commit 2420724 into development Apr 23, 2026
1 check passed
@sondresjolyst sondresjolyst deleted the fix/electricity-fetch-logging-and-daily-refresh branch April 23, 2026 05:58
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