diff --git a/src/main.rs b/src/main.rs index 995c0dc..11c5109 100644 --- a/src/main.rs +++ b/src/main.rs @@ -152,7 +152,15 @@ async fn main() -> color_eyre::Result<()> { } let address = args.address.parse::()?; - warp::serve(routes).run(address).await; + let (_, fut) = warp::serve(routes).bind_with_graceful_shutdown(address, async move { + tokio::signal::ctrl_c() + .await + .expect("failed to listen to shutdown signal"); + }); + + fut.await; + println!(); + tracing::info!("shutting down..."); Ok(()) }