Skip to content

Commit b1c73a7

Browse files
committed
chore: use select
1 parent 067cb0e commit b1c73a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

consensus/state.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,12 @@ func (cs *State) enterPrecommit(height int64, round int32) {
16271627
waitTime := cs.precommitDelay()
16281628
logger.Debug("delaying precommit", "delay", waitTime)
16291629
cs.unlockAll()
1630-
time.Sleep(waitTime)
1630+
t := time.NewTimer(waitTime)
1631+
select {
1632+
case <-cs.Quit():
1633+
return
1634+
case <-t.C:
1635+
}
16311636
cs.lockAll()
16321637
cs.rs.StartedPrecommitSleep.Store(false)
16331638
} else {

0 commit comments

Comments
 (0)