You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common pattern is to run background tasks (goroutines) from an init server function (e.g. a controller). When these background tasks fail, (consider the case where due to a programmer bug there is a panic)
It would be nice to write an init func something like
And have server.Start() actually return an error as desired.
Strawman proposal would be to add a new method to InitInfo:
// ShutdownServerWithErr closes the server, waiting for any in-flight requests to finish (or the context to be cancelled).
// The server is shutdown with an error, causing `Start` to return an error.
ShutdownServer func(context.Context, err error) error
I'd be happy to implement this if this sounds good.
The text was updated successfully, but these errors were encountered:
Thanks for the feedback. Just for clarification, is it the case that the current Close() and Shutdown(context.Context) functions do close/shut down the server, but cause the start function to just return nil rather than an error?
Got it. Yes, I think this is reasonable -- would just say that, in the comment/documentation for the function, you should note that the function is the equivalent of calling Shutdown, but will return a non-nil error. I think it would also make sense for the PR to update the implementation of Shutdown to use ShutdownServer with a nil error.
Feature Request
A common pattern is to run background tasks (goroutines) from an init server function (e.g. a controller). When these background tasks fail, (consider the case where due to a programmer bug there is a panic)
It would be nice to write an init func something like
And have
server.Start()
actually return an error as desired.Strawman proposal would be to add a new method to InitInfo:
I'd be happy to implement this if this sounds good.
The text was updated successfully, but these errors were encountered: