From 41d26d1b960ff6a0a4d27aca917084303166a9a9 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 13 Jul 2018 22:13:02 +0100 Subject: [PATCH] Don't shutdown the gRPC server the minute a signal is received. gRPC behaviour should be the same as HTTP: Run() exits when a signal is received, and Stop() stops the handling of requests. And as we no longer call GracefulShutdown in Run, call it in Stop - one should always try to shutdown gracefully. Signed-off-by: Tom Wilkie --- server/server.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/server.go b/server/server.go index 82632285..6572a6d3 100644 --- a/server/server.go +++ b/server/server.go @@ -168,7 +168,6 @@ func (s *Server) Run() { // for HTTP over gRPC, ensure we don't double-count the middleware httpgrpc.RegisterHTTPServer(s.GRPC, httpgrpc_server.NewServer(s.HTTP)) go s.GRPC.Serve(s.grpcListener) - defer s.GRPC.GracefulStop() // Wait for a signal s.handler.Loop() @@ -185,5 +184,5 @@ func (s *Server) Shutdown() { defer cancel() // releases resources if httpServer.Shutdown completes before timeout elapses s.httpServer.Shutdown(ctx) - s.GRPC.Stop() + s.GRPC.GracefulStop() }