Skip to main content

Module poll

Module poll 

Source
Expand description

Background pollers for engine endpoints that do not have a dedicated push channel.

At present, that’s one surface: GET /operator/state. The classifier runs on the engine host (ADR-016) and the endpoint is the CLI’s only window into the current behavioral label. The poller runs at a deliberately relaxed cadence — operator state changes on human time scales, and over-polling an engine we do not own is rude.

Transient errors are swallowed with a warn-log; the subscriber task keeps trying. Fatal errors (bad base URL, unauth) surface at construction time. The mirror’s Stat<Snapshot> freshness metadata is what the widget uses to distinguish “never polled” from “stale” from “fresh” — see statusbar.rs for the render side.

Structs§

EngineStatePoller
Handle to a running HTTP-backfill poller for the core mirror fields.
OperatorStatePoller
Handle to a running operator-state poller.

Constants§

BACKFILL_BACKOFF
Backoff after a backfill failure. Matches POLL_BACKOFF — if the engine is down the WS-side indicator already tells the operator; doubling the visible cadence helps no one.
BACKFILL_INTERVAL
How often the backfill poller pulls each endpoint. 30 s is slow enough to be polite to the engine and fast enough that a WS dropout doesn’t leave the operator staring at a stale mirror for long. Callers that want a different cadence (tests, mainly) use EngineStatePoller::spawn_with_interval.
POLL_BACKOFF
How long to wait after a failed request before retrying. We intentionally do not escalate backoff here: if the engine is down, the status bar already shows engine:DOWN via the WS subscriber, and the operator-state segment degrading to ops:? after 30 s is the honest rendering (see OPERATOR_STATE_STALE_AFTER in the widget).
POLL_INTERVAL
How often the poller fetches /operator/state. 5 s matches the Addendum A §2 target classifier tick cadence — faster than the operator can notice a mislabel, slower than a naive polling loop.