Skip to content

Commit

Permalink
fix: graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
w-h-a committed Jul 4, 2024
1 parent 8edefb3 commit b8f432b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/grpcserver/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ func (s *grpcServer) start() error {
close(exit)
}()

countdown := time.NewTimer(10 * time.Second)

select {
case <-exit:
case <-time.After(time.Minute):
countdown.Stop()
case <-countdown.C:
s.server.Stop()
}

Expand Down

0 comments on commit b8f432b

Please sign in to comment.