Skip to content

Commit

Permalink
Merge pull request #102 from KyberNetwork/merge_main_into_release
Browse files Browse the repository at this point in the history
Merge main into release
  • Loading branch information
hiepnv90 authored Jan 12, 2024
2 parents 60267f7 + c9e7cc0 commit 85b7901
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/listener/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ func (l *Listener) subscribeNewBlockHead(ctx context.Context, blockCh chan<- typ
ticker := time.NewTicker(l.sanityCheckInterval)
defer ticker.Stop()

lastReceivedTime := time.Now()
// Reset sliding window buffer.
seq := uint64(1)
l.queue.Clear()

lastReceivedTime := time.Now()
for {
select {
case <-ctx.Done():
Expand Down
3 changes: 2 additions & 1 deletion pkg/listener/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewQueue(maxSize int) *Queue {
panic("Invalid maxSize, should be at least 1")
}

queue := &Queue{maxSize: maxSize, seq: 1}
queue := &Queue{maxSize: maxSize}
queue.clear()

return queue
Expand Down Expand Up @@ -156,6 +156,7 @@ func (q *Queue) clear() {

q.start = 0
q.size = 0
q.seq = 1
}

// Clear removes all elements from the queue.
Expand Down

0 comments on commit 85b7901

Please sign in to comment.