Module longpoll

Module longpoll 

Source
Expand description

Long-poll worker: holds an open GET /v1/agent/dispatch?wait=60 against the CP. On a 200 with a Dispatch body, fetches + verifies the rollout manifest via the disk-backed ManifestCache, asserts the dispatched target_closure matches the manifest’s declaration for this host (RFC-0005 §4.1 advisory-payload contract), then emits LocalActivate into the reducer.

First dispatch per rollout fetches /v1/rollouts/{id} from CP, verifies, writes through to disk. Repeat dispatches hit disk + re-verify (defense in depth). Disk cache + on-demand fetch is the model; no in-memory pre-priming step, no periodic-refresh worker.

Constants§

ERROR_BACKOFF 🔒
Per-error backoff floor. Real network failures should NOT hot-loop; 5s gives the CP a chance to recover (e.g. mid-rollout deploy).
HTTP_TIMEOUT 🔒
HTTP timeout = wait + 5s slack to cover request setup + response.
WAIT_SECS 🔒
Per-poll wait window. Plan 06’s locked-in value; matches CP’s dispatch::MAX_WAIT_SECS.

Functions§

handle_dispatch 🔒
poll_once 🔒
spawn