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

feat(web): allow to shutdown faster when there is no more requests #1193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joelwurtz
Copy link
Contributor

@joelwurtz joelwurtz commented Jan 30, 2025

Ref #1190

Still a draft but this is an example on how we could shutdown faster and cleanly even when there is still pending connections, this is a proof of concept on h1 dispatcher, h2 and h3 can do something similar also

I used a tokio::sync::watch channel tokio_util::CancellationToken to check for shutdown change but maybe there is a better solution (there is a lot of things to adapt, like naming, correct deps, etc ... but this is mainly an example for the moment)

@joelwurtz joelwurtz force-pushed the feat/shutdown-when-no-requests branch from 52ce564 to 27dfc69 Compare January 30, 2025 17:00
@@ -34,7 +34,7 @@ async fn h1_get() -> Result<(), Error> {
assert_eq!("GET Response", body);
}

handle.try_handle()?.stop(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

before this change this would wait for the keep alive timeout, now it shut down instantly (because there is no pending request)

@joelwurtz joelwurtz force-pushed the feat/shutdown-when-no-requests branch from 2f236c9 to 91a691c Compare February 27, 2025 09:00
@joelwurtz joelwurtz changed the title feat(web): allow to shutdown faster when there is no more requests on h1 feat(web): allow to shutdown faster when there is no more requests Feb 27, 2025
@joelwurtz joelwurtz marked this pull request as ready for review February 27, 2025 09:01
@joelwurtz
Copy link
Contributor Author

joelwurtz commented Feb 27, 2025

This implementation works to shutdown faster on h1 / h2 and h3 when there is no more requests, however i'm sure there is a better way to do it

@joelwurtz joelwurtz force-pushed the feat/shutdown-when-no-requests branch from 91a691c to f2d2069 Compare February 27, 2025 09:07
@joelwurtz joelwurtz force-pushed the feat/shutdown-when-no-requests branch from f2d2069 to cc92695 Compare February 27, 2025 10:22
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.

1 participant