axum-server icon indicating copy to clipboard operation
axum-server copied to clipboard

What do you think about adding method `with_graceful_shutdown()` like in Axum?

Open frederikhors opened this issue 1 year ago • 1 comments

What do you think about adding method with_graceful_shutdown() like in Axum?

frederikhors avatar Jan 21 '24 21:01 frederikhors

Have you considered this?

let handle = axum_server::Handle::default();

let handle_clone = handle.clone();
tokio::spawn(async move {
    // TODO: what you would have put in `with_graceful_shutdown`

    handle_clone.graceful_shutdown(Some(Duration::from_secs(1)));
});

axum_server::bind(...)
    .handle(handle)
    .serve(...)
    .await

finnbear avatar Aug 19 '24 02:08 finnbear