[]previous and next page

Graceful shutdown

On SIGTERM or SIGINT (an orchestrator stopping the container, Ctrl-C) the server drains.

For agentsUpdated

On SIGTERM or SIGINT (an orchestrator stopping the container, Ctrl-C) the server drains. draining becomes true, the listener closes so new connections are refused, idle keep-alive connections are closed, and requests in flight run to completion with Connection: close. After gracefulShutdownMs whatever is left is closed. Then exit(0) is called. A request that still arrives on an open connection after draining began gets 503 with Retry-After: 1. close() does the same by hand, returns one promise however often it is called, and removes the signal listeners; call it from your shutdown code with shutdownSignals: false. Set the orchestrator's stop timeout above gracefulShutdownMs.