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

Remove duplication in serving with and without graceful shutdown #2803

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

Conversation

jplatte
Copy link
Member

@jplatte jplatte commented Jun 22, 2024

Simpler implementation of the same idea from #2478, against latest main.

Closes #2478.

@jplatte jplatte force-pushed the jplatte/reduce-serve-duplication branch from 7047547 to 04b729e Compare July 18, 2024 09:32
Copy link
Contributor

@mladedav mladedav left a comment

Choose a reason for hiding this comment

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

This is great.

I just wonder if this couldn't go one step further and merge the Serve and WithGracefulShutdown into a single generic type. As it stands now, Serve<M, S> is just WithGracefulShutdown<M, S, Pending>` so why not embrace it?

The only difference I know of is that with the current separation users cannot call with_graceful_shutdown multiple times but I don't think that would be a problem.

@jplatte
Copy link
Member Author

jplatte commented Jul 19, 2024

Sure, could do that. But it feels like leaking implementation details into the public API, and I don't see the little bit of extra code as much of a problem.

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.

None yet

2 participants