From c7b135b3cf6c0b108759c8bacc7e9a0e8af43c9f Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Thu, 19 Jul 2018 13:22:01 +0100 Subject: [PATCH] Don't shutdown the gRPC server the minute a signal is received. (#99) 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 3064136a..39658b5d 100644 --- a/server/server.go +++ b/server/server.go @@ -186,7 +186,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() @@ -203,5 +202,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() }