-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Is your feature request related to a problem? Please describe.
Discussion from 4878 led to a decision to design Shutdown to follow language patterns for how it and Run should operate. Following http.Server as an example the following behaviors should be met:
Shutdownbe safe to be called at any point. Even if there is no action to take- If
Shutdownis called beforeRunit will exit cleanly and the next call toRunwill exit due to the previousShutdown - If
Shutdownis called whileRunis active it should block untilRunhas confirmed shutdown.
Point 3 isn't currently implemented but desired behavior.
Describe the solution you'd like
Shutdown will block until Run has confirmed cleanup. Whatever Shutdown checks for should not stop it from cleanly exiting if Run hasn't been called yet or after Run was called.
Describe alternatives you've considered
Alternative is don't block Shutdown and just exit like it does now after closing the channel.
Additional context
Action item from #4878
If we want to go this route I think there needs to be some discussion on what Shutdown should block on. It seems like it should be when the state is Closing but that won't allow Shutdown to cleanly exit if called before or after Run.