From 6df412cf1e138c6d3b3f02691f566d9edcf9c76f Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Sat, 3 Sep 2022 15:21:41 +0300 Subject: [PATCH] [~] Refactor --- d1/dynu_update.py | 7 ++++++- docker/dynu/Dockerfile | 8 +------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/d1/dynu_update.py b/d1/dynu_update.py index 1f8536c..25d8960 100644 --- a/d1/dynu_update.py +++ b/d1/dynu_update.py @@ -87,6 +87,7 @@ def service(): logging.warning('start dynu_update') need_wait = False + last_disabled = False while True: try: @@ -101,9 +102,13 @@ def service(): dynu_config = json.load(f) if dynu_config.get('enabled') != True: - logging.warning('disabled') + if not last_disabled: + last_disabled = True + logging.warning('disabled') + need_wait = True continue else: + last_disabled = False logging.warning('loaded dynu_config') with multiprocessing.Pool(processes=1) as pool: diff --git a/docker/dynu/Dockerfile b/docker/dynu/Dockerfile index 5866986..b41b322 100644 --- a/docker/dynu/Dockerfile +++ b/docker/dynu/Dockerfile @@ -3,10 +3,4 @@ WORKDIR /app RUN pip3 install requests -ENTRYPOINT /bin/sh -c "\ - while true; do \ - date; \ - python3 d1/dynu_update.py tmp/cache/dynu.auth.json ngrok; \ - sleep 900; \ - done; \ -" +ENTRYPOINT exec python3 d1/dynu_update tmp/cache/dynu.auth.json ngrok