Browse Source

do not wait for HTTP connections to close when shutting down the server (#2909)

pull/2911/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
cd2495423a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      internal/protocols/httpserv/wrapped_server.go

4
internal/protocols/httpserv/wrapped_server.go

@ -86,6 +86,8 @@ func NewWrappedServer(
// Close closes all resources and waits for all routines to return. // Close closes all resources and waits for all routines to return.
func (s *WrappedServer) Close() { func (s *WrappedServer) Close() {
s.inner.Shutdown(context.Background()) ctx, ctxCancel := context.WithCancel(context.Background())
ctxCancel()
s.inner.Shutdown(ctx)
s.ln.Close() // in case Shutdown() is called before Serve() s.ln.Close() // in case Shutdown() is called before Serve()
} }

Loading…
Cancel
Save