Module outbound

Module outbound 

Source
Expand description

Outbound queue drainer. Periodically scans {state_dir}/outbound-queue/ and POSTs each pending event to /v1/agent/events, deleting on success. Acts as the network-side companion to the applier’s LocalEmitEvent writes.

On CP unreachable / network failure the file stays on disk; the next drain tick retries. The heartbeat worker’s X-Nixfleet-Replay-From handler triggers an immediate drain pass by sending into the DrainKick channel.

Constants§

DRAIN_INTERVAL 🔒
Outer cadence. Plan 07’s locked-in decision keeps the drain hot-loop-free: a single tick per N seconds, kicked by the DrainKick channel when something new lands or when the heartbeat worker observed CP drift.
HTTP_TIMEOUT 🔒
HTTP timeout per POST. CP returns 204 fast (in-memory dispatch channel push); 10s is generous slack.

Functions§

drain_once 🔒
post_one 🔒
spawn

Type Aliases§

DrainKick