Repository navigation
Commit a3f8387
fix(gecloud): keep live data flowing during slow settings refreshes; a stale read no longer overwrites a newer write
GECloudDirect.run() awaited the whole periodic settings refresh inline. A register the
inverter lists but cannot serve (AC charge slots 8/9 on a three-phase inverter) burns its
full retry budget on every refresh, so one refresh could hold the component for ten minutes
or more with no status or meter updates (a 656 s gap was observed in production).
- The periodic refresh now runs as its own task. run() waits up to
SETTINGS_REFRESH_WAIT_SECONDS (20 s) for it, then carries on with live data. A refresh that
is still running is never overlapped. Startup and device-list changes still read the
settings inline, because automatic config is built from them; a running background
refresh is cancelled first. final() cancels the task and waits for it, and a cancelled
settings read cancels and waits for its own read tasks.
- A write confirmed while a read of the same register is in flight now wins over the older
value read back. Pending writes are kept while a refresh is running, applied when the
results are merged, and also written into the cached register by
async_write_inverter_setting, so a register replaced mid-write is not left stale. A
register written twice in one cycle reads back as its latest value.
- A device removed from the account while its settings are read in the background is not
put back into the cache, the entity map or the backoff state.
- A register whose read fails keeps its last known value, now marked read_failed and
published with a read_failed attribute rather than passed off as a fresh readback.
- On periodic refreshes, a register that has failed 3 refreshes in a row is backed off:
skipped for 1, 2, 4 and then at most 6 refreshes, then tried again. It is never hidden for
good, and startup and new-device reads always read every register.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BaJjLpuMEtQYfvmTRcFJf1 parent 1faff22 commit a3f8387
2 files changed
Lines changed: 609 additions & 50 deletions
0 commit comments