diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go index c03c65481d1..a722b878563 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go @@ -206,22 +206,6 @@ func (b *logBuffer) dequeue(start int64, capacity int, minimumDequeue bool) ([]B } queuesInRange++ - upkeepAvailableLogs, ok := b.availableLogs[qid] - if !ok { - upkeepAvailableLogs = map[int64][]int{} - } - - series2, ok3 := upkeepAvailableLogs[start] - if !ok3 { - series2 = []int{logsInRange} - } else { - series2 = append(series2, logsInRange) - } - - upkeepAvailableLogs[start] = series2 - - b.availableLogs[qid] = upkeepAvailableLogs - if capacity == 0 { // if there is no more capacity for results, just count the remaining logs remainingLogs += logsInRange @@ -247,6 +231,22 @@ func (b *logBuffer) dequeue(start int64, capacity int, minimumDequeue bool) ([]B // update the buffer with how many logs we have dequeued for this window q.dequeued[start] += len(logs) + upkeepAvailableLogs, ok := b.availableLogs[qid] + if !ok { + upkeepAvailableLogs = map[int64][]int{} + } + + series2, ok3 := upkeepAvailableLogs[start] + if !ok3 { + series2 = []int{logsInRange} + } else { + series2 = append(series2, logsInRange) + } + + upkeepAvailableLogs[start] = series2 + + b.availableLogs[qid] = upkeepAvailableLogs + dequeuedLogs, ok := b.dequeuedLogs[qid] if !ok { dequeuedLogs = map[int64][]int{}