pub async fn shutdown_signal(handle: ServerHandle)Expand description
Signal to graceful shutdown.
Required to be manually awaited, if you start server with start_clean/start_with_service functions. Example:
ⓘ
let (server, handle) = start_clean(app_state, app_config, router).await.unwrap();
let default_handle = tokio::spawn(async move { shutdown_signal(handle).await });
tracing::info!("Server is booted.");
tokio::select! {
_ = server => tracing::info!("Server is shutdowned."),
_ = default_handle => std::process::exit(0),
}Graceful coroutine starts automatically with start function.