Module shutdown

Module shutdown 

Source
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§

GracefulShutdown
Graceful shutdown coordinator
RequestGuard
RAII guard for tracking in-flight requests
ShutdownStatus
Shutdown status

Enums§

ShutdownResult
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