From 79609aa6c0f3dcb16c6f30a12dc97e75475d9f25 Mon Sep 17 00:00:00 2001 From: Oleksandr Tsurenko Date: Thu, 11 May 2023 19:20:58 +0200 Subject: [PATCH] TECH-1204 - Adding health-check decorator with debug --- chief_keeper/chief_keeper.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/chief_keeper/chief_keeper.py b/chief_keeper/chief_keeper.py index 9567870..9bb8f49 100644 --- a/chief_keeper/chief_keeper.py +++ b/chief_keeper/chief_keeper.py @@ -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""" @@ -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