Skip to content

Commit

Permalink
Don't shutdown the gRPC server the minute a signal is received. (#99)
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 authored and bboreham committed Jul 19, 2018
1 parent 54f55b1 commit c7b135b
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 @@ -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()
Expand All @@ -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()
}

0 comments on commit c7b135b

Please sign in to comment.