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 7f9e64f2b0a..e1cbf3bc2c5 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 @@ -281,7 +281,11 @@ func (ub *upkeepLogBuffer) enqueue(blockThreshold int64, logsToAdd ...logpoller. ub.visited[logid] = log.BlockNumber } ub.q = logs - dropped := ub.clean(blockThreshold) + + var dropped int + if added > 0 { + dropped = ub.clean(blockThreshold) + } ub.lggr.Debugf("Enqueued %d logs, dropped %d with blockThreshold %d", added, dropped, blockThreshold) prommetrics.AutomationLogsInLogBuffer.Add(float64(added)) @@ -297,7 +301,7 @@ func (ub *upkeepLogBuffer) clean(blockThreshold int64) int { // sort.SliceStable(updated, func(i, j int) bool { // return LogSorter(updated[i], updated[j]) // }) - updated := make([]logpoller.Log, 0, maxLogs) + updated := make([]logpoller.Log, 0) var dropped int for _, l := range ub.q { if l.BlockNumber > blockThreshold {