From 12bafba6b930be23eafddd7cd3c6f868460c5870 Mon Sep 17 00:00:00 2001 From: Roman Buryan Date: Mon, 16 Nov 2026 18:10:48 +0300 Subject: [PATCH] =?UTF-8?q?[OPS]=20morning=5Fdigest:=20=D0=BF=D0=BE=D0=B2?= =?UTF-8?q?=D1=82=D0=BE=D1=80=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=B0?= =?UTF-8?q?=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0=20(=D1=85=D0=B0?= =?UTF-8?q?=D0=B1=20=D0=B1=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BD=D1=8F=D1=82=20=D1=82=D1=80=D0=B8=D0=B0=D0=B6=D0=B5=D0=BC?= =?UTF-8?q?)=20=D0=B8=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B0=D1=83=D1=82=2030=20?= =?UTF-8?q?=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/scripts/morning_digest.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ops/scripts/morning_digest.py b/ops/scripts/morning_digest.py index 248f0ed..2bb93ee 100755 --- a/ops/scripts/morning_digest.py +++ b/ops/scripts/morning_digest.py @@ -42,12 +42,19 @@ def sh(cmd, timeout=60): def services(): - try: - import urllib.request as u - with u.urlopen(HUB + "/status.json", timeout=15) as r: - d = json.loads(r.read()) - except Exception: - return "• Службы: хаб не отвечает", [] + import urllib.request as u + d = None + for attempt in range(2): + try: + with u.urlopen(HUB + "/status.json", timeout=30) as r: + d = json.loads(r.read()) + break + except Exception: + if attempt == 0: + import time as _t + _t.sleep(3) + if d is None: + return "• Службы: хаб не отвечает (2 попытки)", [] svc = d.get("services") or [] down = [s.get("name") for s in svc if not s.get("up")] if down: