-
Notifications
You must be signed in to change notification settings - Fork 355
Stop the host when the single session server service finishes #226
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
Stop the host when the single session server service finishes #226
Conversation
The host should do this for you.
And then this in the comment: // If the server is shutting down, we need to cancel all SSE connections immediately without waiting for HostOptions.ShutdownTimeout
// which defaults to 30 seconds.
using var sseCts = CancellationTokenSource.CreateLinkedTokenSource(context.RequestAborted, hostApplicationLifetime.ApplicationStopping);
|
Sorry, I just noticed both those issues were stdio servers. I'm not sure what's going on there. I do think changes similar to dotnet/cli#10720 might help. |
When StopAsync is called. StopAsync isn't being called.
As far as I can tell, the hosting infrastructure doesn't automatically exit when a background service exits.
It would mask it, certainly. But I think the server should be able to gracefully exit on its own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a second, but now I see the logic behind this change. As you could probably tell, when I left my first comment, I was still thinking about HTTP scenarios. I'm not used to single-session servers 😆
It'd be nice if we could have a test though. It should be easy enough to have a client close the stream and verify the server host stops within a timeout. |
6e5066b
to
4b1869b
Compare
@halter73, is this the right way to do it?
Contributes to #221
Closes #155