Skip to content

Commit

Permalink
Don't shutdown the gRPC server the minute a signal is received.
Browse files Browse the repository at this point in the history
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 <tom.wilkie@gmail.com>
  • Loading branch information
tomwilkie committed Jul 16, 2018
1 parent b6bc05f commit 41d26d1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
}

0 comments on commit 41d26d1

Please sign in to comment.