From 1c179f9225b1ef76eb82bb1874a773aec380aa04 Mon Sep 17 00:00:00 2001 From: Oliver Townsend Date: Fri, 16 Feb 2024 15:52:40 +0800 Subject: [PATCH] Remove logsInBuffer var --- .../ocr2keeper/evmregistry/v21/logprovider/buffer.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go index 8349b337743..6418d683869 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go @@ -151,8 +151,6 @@ type logEventBuffer struct { blocks []fetchedBlock // latestBlock is the latest block number seen latestBlock int64 - // logsInBuffer is the number of logs currently in the buffer - logsInBuffer int64 } func newLogEventBuffer(lggr logger.Logger, size, numOfLogUpkeeps, fastExecLogsHigh int) *logEventBuffer { @@ -233,7 +231,7 @@ func (b *logEventBuffer) enqueue(id *big.Int, logs ...logpoller.Log) int { } if added > 0 { lggr.Debugw("Added logs to buffer", "addedLogs", added, "dropped", dropped, "latestBlock", latestBlock) - prommetrics.AutomationLogsInLogBuffer.Set(float64(atomic.AddInt64(&b.logsInBuffer, int64(added-dropped)))) + prommetrics.AutomationLogsInLogBuffer.Add(float64(added - dropped)) } return added - dropped @@ -335,7 +333,7 @@ func (b *logEventBuffer) dequeueRange(start, end int64, upkeepLimit, totalLimit if len(results) > 0 { b.lggr.Debugw("Dequeued logs", "results", len(results), "start", start, "end", end) - prommetrics.AutomationLogsInLogBuffer.Set(float64(atomic.AddInt64(&b.logsInBuffer, -int64(len(results))))) + prommetrics.AutomationLogsInLogBuffer.Sub(float64(len(results))) } return results