Skip to main content

DRAIN_TIMEOUT

Constant DRAIN_TIMEOUT 

Source
pub const DRAIN_TIMEOUT: Duration;
Expand description

How long a connection has to finish once shutdown has been asked for.

Graceful shutdown means finishing the request in flight — and one of the requests this server serves, /{application}/{profile}/stream, is a response body that never ends by design. Waiting on every body would mean waiting for every subscriber to disconnect, so a rollout would hang on exactly the clients that were paying attention.

So the drain has a deadline, and both serving paths hold to it. A subscriber loses its stream and reconnects, which is what an EventSource does by itself and what the Last-Event-ID rules exist for; a fetch genuinely in flight has thirty seconds, which is far longer than any endpoint here takes.