Skip to content

Commit

Permalink
TECH-1204 - Adding health-check decorator with debug
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrUA committed May 11, 2023
1 parent 34a9a17 commit 79609aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions chief_keeper/chief_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@

from auction_keeper.gas import DynamicGasPrice

HEALTHCHECK_FILE_PATH = "/tmp/health.log"


def healthy(func):
def inner():
print("==================== Healthcheck ====================")
with open(HEALTHCHECK_FILE_PATH, "W") as healthcheck_file:
healthcheck_file.write(int(time.time()))
func()

return inner


class ChiefKeeper:
"""Keeper that lifts the hat and streamlines executive actions"""
Expand Down Expand Up @@ -214,6 +226,7 @@ def initial_query(self):

self.logger.info(result)

@healthy
def process_block(self):
"""Callback called on each new block. If too many errors, terminate the keeper.
This is the entrypoint to the Keeper's monitoring logic
Expand Down

0 comments on commit 79609aa

Please sign in to comment.