Skip to content

Commit 6ea24f4

Browse files
authored
fix race condition (#337)
1 parent 14e65e1 commit 6ea24f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

epoch.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,12 +2572,13 @@ func (e *Epoch) monitorProgress(round uint64) {
25722572

25732573
// Check if we have advanced to a higher round in the meantime while this task was dispatched.
25742574
e.lock.Lock()
2575-
shouldAbort := round < e.round
2575+
epochRound := e.round
2576+
shouldAbort := round < epochRound
25762577
e.lock.Unlock()
25772578

25782579
if shouldAbort {
25792580
e.Logger.Debug("Aborting monitoring progress for round because we advanced to a higher round",
2580-
zap.Uint64("monitored round", round), zap.Uint64("new round", e.round))
2581+
zap.Uint64("monitored round", round), zap.Uint64("new round", epochRound))
25812582
return
25822583
}
25832584

0 commit comments

Comments
 (0)