Skip to main content

shutdown_requested

Function shutdown_requested 

Source
pub async fn shutdown_requested()
Expand description

The canned 503 a request gets when the server is not ready, draining, or Resolve when the process is asked to stop: SIGTERM or SIGINT on unix, Ctrl-C elsewhere.

Deliberately a FUTURE the accept loop selects on rather than a spawned task. Two of the three servers that need it — the tree-walker’s and the bytecode VM’s — drive !Send connection futures inline on a current-thread runtime and cannot spawn anything; handing them a future is what lets all three share one shutdown story instead of growing three.

If the signal handlers cannot be installed (a sandbox that forbids it), this never resolves, which is the right failure: the server keeps serving rather than shutting down because it could not listen for a shutdown.