mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-10 05:53:46 +00:00
Merge pull request #35 from DeBankDeFi/rpc-shutdown-with-timeout
rpc graceful shutdown timeout - merge back from upstream repo
This commit is contained in:
commit
c3f82a6595
1 changed files with 3 additions and 2 deletions
|
|
@ -269,8 +269,9 @@ func (h *httpServer) doStop() {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
err := h.server.Shutdown(ctx)
|
err := h.server.Shutdown(ctx)
|
||||||
if err != nil {
|
if err == ctx.Err() {
|
||||||
h.log.Warn("Something wrong with HTTP server graceful shutdown", "error", err)
|
h.log.Warn("HTTP server graceful shutdown timed out")
|
||||||
|
h.server.Close()
|
||||||
}
|
}
|
||||||
h.listener.Close()
|
h.listener.Close()
|
||||||
h.log.Info("HTTP server stopped", "endpoint", h.listener.Addr())
|
h.log.Info("HTTP server stopped", "endpoint", h.listener.Addr())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue