Skip to content

Commit

Permalink
Fix for ERC20 load test freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbundalo committed Apr 17, 2024
1 parent 162382e commit 6f675df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions consensus/polybft/stale_sequence_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type staleSequenceCheck struct {
mtx *sync.Mutex
checkFrequency time.Duration
sequenceShouldStop chan struct{}
sequenceStopping chan struct{}
stop chan struct{}
stopped chan struct{}
getHeader func() *types.Header
Expand All @@ -34,6 +35,7 @@ func newStaleSequenceCheck(logger hclog.Logger,

func (s *staleSequenceCheck) startChecking() {
s.sequenceShouldStop = make(chan struct{}, 1)
s.sequenceStopping = make(chan struct{})
s.stop = make(chan struct{})
s.stopped = make(chan struct{})

Expand All @@ -49,6 +51,8 @@ func (s *staleSequenceCheck) startChecking() {
ticker.Stop()

return
case <-s.sequenceStopping:
ticker.Stop()
case <-ticker.C:
s.checkForStaleness()
}
Expand Down Expand Up @@ -85,5 +89,6 @@ func (s *staleSequenceCheck) chainHeightUpdated(height uint64) {
if height >= s.currentSequence {
s.logger.Info("[staleSequenceCheck] stale sequence detected", "height", height, "currentSequence", s.currentSequence)
s.sequenceShouldStop <- struct{}{}
close(s.sequenceStopping)
}
}

0 comments on commit 6f675df

Please sign in to comment.