Abort the poll cycle on a login failure #10

Merged
nexus merged 1 commit from fix/abort-cycle-on-login-failure into main 2026-07-27 18:30:32 +02:00
Owner

During a cloud outage the login endpoint timed out. Because the session was
gone, every channel re-attempted its own login — six channels each burning the
full 20s HTTP timeout, so one failed cycle stalled for ~2 minutes and logged six
identical reading a channel failed warnings (as seen in production on
2026-07-27).

Login is shared by every channel and device, so one failure dooms the whole
cycle. Login errors now carry a wifipool.ErrLoginFailed sentinel; the poller
stops at the first one, skips the network calls for the remaining devices, and
logs it once:

login to the cloud failed; skipping the rest of this cycle instead of
retrying it per channel

Staleness is still evaluated and every device rendered (unhealthy), so entities
age out and availability stays correct, and the next cycle recovers on its own
once the cloud responds again.

A single channel-level getStats failure is deliberately unchanged — it is
channel-specific and must not discard readings from the others.

New tests: login attempted once per cycle (not per channel), remaining devices
skipped, recovery on the next cycle, and the sentinel is wrapped. Full suite and
golangci-lint green.

During a cloud outage the login endpoint timed out. Because the session was gone, every channel re-attempted its own login — six channels each burning the full 20s HTTP timeout, so one failed cycle stalled for ~2 minutes and logged six identical `reading a channel failed` warnings (as seen in production on 2026-07-27). Login is shared by every channel and device, so one failure dooms the whole cycle. Login errors now carry a `wifipool.ErrLoginFailed` sentinel; the poller stops at the first one, skips the network calls for the remaining devices, and logs it once: login to the cloud failed; skipping the rest of this cycle instead of retrying it per channel Staleness is still evaluated and every device rendered (unhealthy), so entities age out and availability stays correct, and the next cycle recovers on its own once the cloud responds again. A single channel-level getStats failure is deliberately unchanged — it is channel-specific and must not discard readings from the others. New tests: login attempted once per cycle (not per channel), remaining devices skipped, recovery on the next cycle, and the sentinel is wrapped. Full suite and golangci-lint green.
Abort the poll cycle on a login failure instead of retrying it per channel
All checks were successful
CI / test (pull_request) Successful in 2m36s
CI / image (pull_request) Successful in 1m1s
CI / publish-commit-tag (push) Has been skipped
CI / test (push) Successful in 2m50s
CI / image (push) Successful in 55s
CI / publish-commit-tag (pull_request) Has been skipped
CI / publish-version-tag (pull_request) Has been skipped
CI / publish-version-tag (push) Has been skipped
cdc817f213
During a cloud outage the login endpoint timed out, and because the session was
gone every channel re-attempted its own login — six channels each burning the
full 20s HTTP timeout, so one failed cycle stalled for ~2 minutes and logged six
identical warnings.

Login is shared by every channel and device, so one failure dooms the whole
cycle. Login errors now carry a wifipool.ErrLoginFailed sentinel; the poller
stops at the first one, skips the network calls for the remaining devices, and
logs it once. Staleness is still evaluated and every device rendered, so
entities age out and availability stays correct, and the next cycle recovers on
its own once the cloud responds again.

A single channel-level getStats failure is unchanged — it is channel-specific
and must not abort readings from the others.
nexus merged commit 8063b16813 into main 2026-07-27 18:30:32 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nexus/WifiPoolToMQTT!10
No description provided.