Skip to content

Commit

Permalink
fix: reset
Browse files Browse the repository at this point in the history
  • Loading branch information
magicalne committed Sep 26, 2022
1 parent 1845c51 commit 4edc65f
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions agent/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,12 @@ def update_metrics(tip_number, ping, last_block_hash: str,
"""
def reset_metrics():
with TaskLock:
global BlockNumber
global CommitTransacionCount
global DepositDict
global WithdrawalDict
if BlockNumber is not None:
last_block_num = BlockNumber - 1
for k in list(CommitTransacionCount.keys()):
if k <= last_block_num:
CommitTransacionCount.pop(k, None)
for k in list(DepositDict.keys()):
if k <= last_block_num:
DepositDict.pop(last_block_num, None)
for k in list(WithdrawalDict.keys()):
if k <= last_block_num:
WithdrawalDict.pop(last_block_num, None)
logging.info(f"Reset metrics for blocks before: {last_block_num}")
CommitTransacionCount = {}
DepositDict = {}
WithdrawalDict = {}

"""
General metrics job.
Expand Down

0 comments on commit 4edc65f

Please sign in to comment.