Skip to content

Commit

Permalink
Commentary.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirTalwar committed Sep 13, 2023
1 parent 32c64b6 commit b0d2f5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rust-connector-sdk/src/default_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,20 @@ where
axum::Server::bind(&address)
.serve(router.into_make_service())
.with_graceful_shutdown(async {
// wait for a SIGINT, i.e. a Ctrl+C from the keyboard
let sigint = async {
tokio::signal::ctrl_c()
.await
.expect("unable to install signal handler")
};
// wait for a SIGTERM, i.e. a normal `kill` command
let sigterm = async {
tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())
.expect("failed to install signal handler")
.recv()
.await;
.await
};

// block until either of the above happens
tokio::select! {
_ = sigint => (),
_ = sigterm => (),
Expand Down

0 comments on commit b0d2f5a

Please sign in to comment.