mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
Grpc graceful shutdown deadline (#1414)
* grpc_graceful_shutdown_deadline * grpc_graceful_shutdown_deadline
This commit is contained in:
parent
71ef201c17
commit
aebb2d23c8
@ -849,7 +849,16 @@ func (s *Ethereum) Stop() error {
|
||||
// Stop all the peer-related stuff first.
|
||||
s.protocolManager.Stop()
|
||||
if s.privateAPI != nil {
|
||||
s.privateAPI.GracefulStop()
|
||||
shutdownDone := make(chan bool)
|
||||
go func() {
|
||||
defer close(shutdownDone)
|
||||
s.privateAPI.GracefulStop()
|
||||
}()
|
||||
select {
|
||||
case <-time.After(1 * time.Second): // shutdown deadline
|
||||
s.privateAPI.Stop()
|
||||
case <-shutdownDone:
|
||||
}
|
||||
}
|
||||
|
||||
// Then stop everything else.
|
||||
|
Loading…
Reference in New Issue
Block a user