mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-25 20:37:27 +08:00
fix: don't loop when shutting down
This commit is contained in:
parent
0212f13c53
commit
2238333eda
@ -1170,15 +1170,22 @@ func (e *AppConsensusEngine) performBlockingGlobalHypersync(proposer []byte, exp
|
||||
|
||||
// Wait for any existing sync to complete first
|
||||
for e.globalProverSyncInProgress.Load() {
|
||||
e.logger.Debug("blocking hypersync: waiting for existing sync to complete")
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
select {
|
||||
case <-e.ShutdownSignal():
|
||||
return
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
}
|
||||
}
|
||||
|
||||
// Mark sync as in progress
|
||||
if !e.globalProverSyncInProgress.CompareAndSwap(false, true) {
|
||||
// Another sync started, wait for it
|
||||
for e.globalProverSyncInProgress.Load() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
select {
|
||||
case <-e.ShutdownSignal():
|
||||
return
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user