mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Review found the sweep-after-bind ordering was probabilistic: the sweep task is spawned before serve(), zero jitter is a valid draw, and interval.tick() fires immediately — so the fleet sweep could still start pre-bind. Replace the timing assumption with a structural guarantee: - new after_listener_bound(oneshot::Receiver, task) helper; the gated task runs only after the signal fires and never runs if the sender is dropped (startup failed before bind) - serve() takes a listener_bound_tx: oneshot::Sender<()> and fires it immediately after the main TCP listener binds - the fleet sweep task is wrapped in after_listener_bound; jitter is now explicitly only lock-contention spreading, not ordering Adds two deterministic tests: a yield-storm test proving the task cannot run before the signal even with zero delay, and a dropped-sender test proving the task never runs when startup fails pre-bind. Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz> Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>