Expand description
Graceful Shutdown - Clean shutdown with in-flight request handling
Provides graceful shutdown support for cloud deployments:
- Stops accepting new requests
- Waits for in-flight requests to complete
- Has a timeout for forced shutdown
§Usage
ⓘ
let shutdown = GracefulShutdown::new(Duration::from_secs(30));
// In your request handler
let guard = shutdown.start_request()?;
// ... do work ...
drop(guard); // Request complete
// When shutting down
shutdown.initiate();
shutdown.wait_for_completion().await;Structs§
- Graceful
Shutdown - Graceful shutdown coordinator
- Request
Guard - RAII guard for tracking in-flight requests
- Shutdown
Status - Shutdown status
Enums§
- Shutdown
Result - Result of shutdown wait
Functions§
- run_
with_ graceful_ shutdown - Helper to run shutdown in a task
- wait_
for_ shutdown_ signal - Shutdown signal handler for Unix systems