fix: don't loop when shutting down

This commit is contained in:
Cassandra Heart 2026-02-23 02:53:19 -06:00
parent 0212f13c53
commit 2238333eda
No known key found for this signature in database
GPG Key ID: 371083BFA6C240AA

View File

@ -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
}