Skip to content
Snippets Groups Projects
Commit b11a3b80 authored by Timo Kösters's avatar Timo Kösters
Browse files

Merge branch 'shutdown-msg' into 'next'

Log caught Ctrl+C or SIGTERM for operator feedback

See merge request famedly/conduit!319
parents 554146f4 3b2b35aa
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
trace::TraceLayer, trace::TraceLayer,
ServiceBuilderExt as _, ServiceBuilderExt as _,
}; };
use tracing::warn;
use tracing_subscriber::{prelude::*, EnvFilter}; use tracing_subscriber::{prelude::*, EnvFilter};
pub use conduit::*; // Re-export everything from the library crate pub use conduit::*; // Re-export everything from the library crate
...@@ -346,11 +347,14 @@ async fn shutdown_signal(handle: ServerHandle) { ...@@ -346,11 +347,14 @@ async fn shutdown_signal(handle: ServerHandle) {
#[cfg(not(unix))] #[cfg(not(unix))]
let terminate = std::future::pending::<()>(); let terminate = std::future::pending::<()>();
let sig: &str;
tokio::select! { tokio::select! {
_ = ctrl_c => {}, _ = ctrl_c => { sig = "Ctrl+C"; },
_ = terminate => {}, _ = terminate => { sig = "SIGTERM"; },
} }
warn!("Received {}, shutting down...", sig);
handle.graceful_shutdown(Some(Duration::from_secs(30))); handle.graceful_shutdown(Some(Duration::from_secs(30)));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment