Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for ERC20 load test freeze #196

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
Loading