Files
jcoffey-dev 8388c97089
ci / node (pull_request) Skipped
ci / version (pull_request) Skipped
ci / docker-build (pull_request) Skipped
ci / publish (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 1m43s
ci / announce (pull_request) Skipped
Drain on SIGTERM instead of dropping everything (K-W5)
On SIGTERM the server exited at once: a JMAP request in flight failed in
the browser, and a request reaching the pod as it went hung until it
timed out. Now it drains (server/src/drain.ts):

1. /api/health answers 503 and every response says Connection: close,
   so load balancers and keep-alive clients move to another replica;
   requests are still served, for SHUTDOWN_DELAY (3 s).
2. No new connections, and every live-update stream (fan-out, relay and
   raw relay) is ended cleanly, so each tab's EventSource reconnects to a
   replica that's staying.
3. Requests in flight get SHUTDOWN_TIMEOUT (5 s) to finish; then what's
   left is closed and the process exits. A second signal stops at once.

Tested in the lab (inbuxa-k8s-lab webmail-restart-test.sh): a rolling
restart under three open tabs and a JMAP request every 200 ms. The
released webmail had a request hang for 30 s; with this, 182-183
requests and none failed, three runs out of three, every stream ending
cleanly and reconnecting.
2026-11-20 00:23:27 -07:00
..