Skip to content

Commit

Permalink
Restrict SIGTERM graceful shutdown to unix only
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewmeyer committed Nov 9, 2024
1 parent b99126f commit 63fe820
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ async fn main() -> Result<()> {
.expect("failed to install Ctrl+C handler");
};

// Handle SIGTERM
// Unix SIGTERM
#[cfg(unix)]
let terminate = async {
signal::unix::signal(signal::unix::SignalKind::terminate())
.expect("failed to install signal handler")
.recv()
.await;
};

#[cfg(not(unix))]
let terminate = std::future::pending();

let graceful = client.clone();
let client_handle = client.run();
Expand Down

0 comments on commit 63fe820

Please sign in to comment.