Clamp the HTTP drain by the tail-hook reserve (closes #170) #454

Merged
clawbot merged 1 commits from issue-170-clamp-drain-by-reserve into next 2026-10-02 20:11:43 +02:00
1 Commits
Author SHA1 Message Date
sneak 9b44189a91 Clamp the HTTP drain by the tail-hook reserve (closes #170)
check / check (push) Waiting to run
The server's stop hook bounded the drain by ShutdownTimeout alone, so
once the archive sweeper or retention reaper had spent part of the fx
stop budget, a request held open could use up the reserve and fx
skipped every hook after the server, the database close included.
The drain now gets the shorter of ShutdownTimeout and what is left
less TailHookReserve, the clamp the Sentry flush already has.

The headroom test also sweeps the time earlier hooks spent and checks
that a drain on the full budget gets all of ShutdownTimeout. A new
test, run on synctest's clock, holds a request open over net.Pipe
against a stop context with only the reserve left. The README and the
reserve's comment say how the reserve is derived and what a slow
sweeper now costs.

Model: opus-5-5
2026-10-02 17:38:15 +00:00