Unverified Commit 25b35c97 authored by Nicolas Gotchac's avatar Nicolas Gotchac Committed by GitHub

node: fix HTTP server always force closing (#25755)

Co-authored-by: 's avatarFelix Lange <fjl@twurst.com>
parent 9d717167
......@@ -267,13 +267,15 @@ func (h *httpServer) doStop() {
h.wsHandler.Store((*rpcHandler)(nil))
wsHandler.server.Stop()
}
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
defer cancel()
err := h.server.Shutdown(ctx)
if err == ctx.Err() {
if err != nil && err == ctx.Err() {
h.log.Warn("HTTP server graceful shutdown timed out")
h.server.Close()
}
h.listener.Close()
h.log.Info("HTTP server stopped", "endpoint", h.listener.Addr())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment