Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare serve for potentially supporting graceful shutdown #2357

Merged
merged 2 commits into from
Nov 26, 2023

Conversation

davidpdrsn
Copy link
Member

I agree that graceful shutdown is probably the most common thing missing from axum::serve and its not exactly easy with the current state of hyper-util (see #2355).

So I could probably convinced to add graceful shutdown support to serve 😅 I think a good API for that would be

axum::serve(listener, service)
    .graceful_shutdown(shutdown_signal_future())
    .await

Doing that requires returning some type we control from serve but we can use IntoFuture so you can still do serve(...).await.

This needs to go in before shipping 0.7 since its a breaking change.

@davidpdrsn davidpdrsn added this to the 0.7 milestone Nov 26, 2023
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to prepare for the possibility without blocking the release on actually adding it!

@davidpdrsn davidpdrsn enabled auto-merge (squash) November 26, 2023 12:17
@davidpdrsn davidpdrsn merged commit 15781fe into main Nov 26, 2023
18 checks passed
@davidpdrsn davidpdrsn deleted the david/serve-graceful-shutdown branch November 26, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants