Skip to main content

SHUTDOWN_GRACE

Constant SHUTDOWN_GRACE 

Source
pub const SHUTDOWN_GRACE: Duration;
Expand description

How long a shutdown waits for connections that are still open before it stops anyway, unless the caller names its own bound; didbot-pds reads [server] drain_secs.

A bound is not optional here, for a reason specific to what this server serves: com.atproto.sync.subscribeRepos is a stream that never ends on its own. A graceful shutdown that waits for every connection to close waits forever whenever one subscriber is attached — which, for a server whose whole point is to be subscribed to, is the normal case rather than the edge one.

What runs after serving ends has to fit inside the deployment’s own window too: the write-ahead log is synced there, and a sync that is SIGKILLed mid-way is the one outcome this whole path exists to avoid. The unit file in terraform-aws-didbot-pds/templates/user_data.sh.tftpl allows 200 seconds from SIGTERM to SIGKILL.