Make last scanned block metric a class variable on ActiveRitualTracker.

pull/3405/head
derekpierre 2024-01-22 16:10:30 -05:00 committed by KPrasch
parent 8535e628c7
commit edc4f939c1
1 changed files with 7 additions and 8 deletions

View File

@ -67,13 +67,6 @@ class EventScannerTask(SimpleTask):
self.start(now=False) # take a breather
LAST_SCANNED_BLOCK_METRIC = Gauge(
"ritual_events_last_scanned_block_number",
"Last scanned block number for ritual events",
registry=REGISTRY,
)
class ActiveRitualTracker:
MAX_CHUNK_SIZE = 10000
@ -84,6 +77,12 @@ class ActiveRitualTracker:
# what's the buffer for potentially receiving repeated events - 10mins?
_RITUAL_TIMEOUT_ADDITIONAL_TTL_BUFFER = 60 * 10
_LAST_SCANNED_BLOCK_METRIC = Gauge(
"ritual_events_last_scanned_block_number",
"Last scanned block number for ritual events",
registry=REGISTRY,
)
class ParticipationState:
def __init__(
self,
@ -426,7 +425,7 @@ class ActiveRitualTracker:
we need to discard the last few blocks from the previous scan results.
"""
last_scanned_block = self.scanner.get_last_scanned_block()
LAST_SCANNED_BLOCK_METRIC.set(last_scanned_block)
self._LAST_SCANNED_BLOCK_METRIC.set(last_scanned_block)
if last_scanned_block == 0:
# first run so calculate starting block number based on dkg timeout