You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #16. After that PR, an exception during the initial loadStations() / loadPrices() calls in DataCache.start() is now caught and logged, and the periodic loop continues running. But the periodic loop's interval is priceRefreshMinutes (default 30 minutes), so a cold-start failure means up to 30 minutes of dataLoaded:false before the next attempt — even though the underlying cause (transient 4xx/5xx, allowlist propagation, network blip) is usually resolved within seconds.
Proposed change
Add a short-interval retry loop before falling into the regular schedule:
on start:
attempt initial load
if it succeeded: enter regular 30-min loop
if it failed:
retry every 30s for up to 5 attempts (~2.5 min total)
if any succeeds: enter regular loop with normal cadence from that point
if all fail: enter regular 30-min loop anyway (current behaviour)
This brings the cold-start recovery window from ~30 min down to ~30 sec for the common case, while preserving the "don't hammer a broken upstream forever" property — after 2.5 min of fast retries we fall back to the polite cadence.
Notes
Keep the retry loop in DataCache.start() directly; don't introduce a separate scheduler.
Summary
Follow-up to #16. After that PR, an exception during the initial
loadStations()/loadPrices()calls inDataCache.start()is now caught and logged, and the periodic loop continues running. But the periodic loop's interval ispriceRefreshMinutes(default 30 minutes), so a cold-start failure means up to 30 minutes ofdataLoaded:falsebefore the next attempt — even though the underlying cause (transient 4xx/5xx, allowlist propagation, network blip) is usually resolved within seconds.Proposed change
Add a short-interval retry loop before falling into the regular schedule:
This brings the cold-start recovery window from ~30 min down to ~30 sec for the common case, while preserving the "don't hammer a broken upstream forever" property — after 2.5 min of fast retries we fall back to the polite cadence.
Notes
DataCache.start()directly; don't introduce a separate scheduler.log.error(...; will retry shortly)rather than; will retry on schedule.coroutineContext.isActiveso a shutdown during retries doesn't get stuck.Related