hard stop if graceful stop fails after 1 second
This commit is contained in:
parent
256d79a47f
commit
df710d9efc
11
grpc.go
11
grpc.go
@ -810,7 +810,18 @@ func (g *grpcServer) Start() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stop the grpc server
|
// stop the grpc server
|
||||||
|
exit := make(chan bool)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
g.srv.GracefulStop()
|
||||||
|
close(exit)
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-exit:
|
||||||
|
case <-time.After(time.Second):
|
||||||
g.srv.Stop()
|
g.srv.Stop()
|
||||||
|
}
|
||||||
|
|
||||||
// close transport
|
// close transport
|
||||||
ch <- nil
|
ch <- nil
|
||||||
|
Loading…
Reference in New Issue
Block a user