pub struct GracefulShutdown {
pub drain_timeout: Duration,
pub restart_channel: bool,
}Expand description
Configuration for crate::Application::with_graceful_shutdown -
opt-in: an Application that never calls that method keeps today’s
exact behavior (a bare axum::serve that exits the instant Ctrl+C is
pressed). Flipping every existing app’s shutdown behavior silently
would be exactly the kind of surprise a framework upgrade shouldn’t
introduce.
Fields§
§drain_timeout: DurationUpper bound on how long serve() waits for in-flight requests to
finish after a shutdown signal, before forcing the process to exit
anyway. Never “wait forever” - a stuck connection (a slow client, a
hung upstream call) must not prevent a deploy or a plain Ctrl+C
from ever completing.
restart_channel: boolIf true, also runs the local restart-trigger admin channel (see
lifecycle::admin) alongside plain Ctrl+C/SIGTERM handling - a
second, independent opt-in on top of graceful shutdown itself,
since not every app wants a local IPC surface open even when it
does want graceful shutdown. false by default. The binary to
spawn as a replacement is std::env::current_exe() for now (a
release-pointer convention, so a newly built binary rather than
the exact file currently running can be targeted, is a later
addition to this same feature).