Skip to content

Commit

Permalink
TECH-1204 - Getting back to working version
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrUA committed May 11, 2023
1 parent 37e7c58 commit 0ced800
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions chief_keeper/chief_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,18 @@

from auction_keeper.gas import DynamicGasPrice

from functools import wraps
HEALTHCHECK_FILE_PATH = "/tmp/health.log"


def healthy(func):
def wrapper(*args, **kwargs):
ts = int(time.time())
print(f"Health-check passed, timestamp: {ts}")
with open(HEALTHCHECK_FILE_PATH, "w") as f:
f.write(str(ts) + "\n")
return func(*args, **kwargs)

return wrapper


class ChiefKeeper:
Expand Down Expand Up @@ -130,12 +141,7 @@ def __init__(self, args: list, **kwargs):
parser.add_argument(
"--gas-maximum", type=str, default=5000, help="gas strategy tuning"
)
parser.add_argument(
"--health-check-file-path",
type=str,
default="/tmp/health.log",
help="path to health-check file",
)

parser.set_defaults(cageFacilitated=False)
self.arguments = parser.parse_args(args)

Expand Down Expand Up @@ -181,17 +187,6 @@ def __init__(self, args: list, **kwargs):
level=(logging.DEBUG if self.arguments.debug else logging.INFO),
)

def healthy(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
ts = int(time.time())
self.logger.info(f"Health-check passed: {ts}")
with open(self.arguments.health_check_file_path, "w") as f:
f.write(str(ts) + "\n")
return func(*args, **kwargs)

return wrapper

def main(self):
"""Initialize the lifecycle and enter into the Keeper Lifecycle controller.
Expand Down

0 comments on commit 0ced800

Please sign in to comment.