Closed KernelPryanic closed 6 years ago
As of commit #8d122aa graceful server shutdown is implemented, auto-tested by the integration test and demonstrated in the examples.
The webwire server now provides a new method: server.Shutdown()
. It blocks the calling goroutine until the server finished processing ongoing requests and signals waiting for the handlers to return. During the shutdown any incoming connections are rejected with 503 service unavailable while requests are rejected with a special error. It should be noted that signals are ignored during the shutdown, which means that from now on one should not rely on signals to be processed for sure.
The requested feature is implemented, there's only one thing I need to do for this feature to be complete and the issue to be closed: Request rejection should be done through a dedicated error reply message type to avoid user-code collisions.
As of commit #e837bfb the server will return a special error message indicating that the request couldn't be processed due to the server being shut down. The client will now be able to differentiate between user-defined and protocol-defined request failures.
Hereby the requested feature is fully implemented and the issue is considered closed.
The webwire server should keep track of currently processed requests and signals and wait for them to finish before closing to avoid data loss and errors. During a requested shutdown new connections, requests and signals must not be accepted.