From 382a910856336c814b0f84474c379b3ff5529595 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Sun, 19 Jan 2025 11:54:47 +0300 Subject: [PATCH] Enhance check_logs function in checker.py to capture and log head subscription ID. Added logic to extract "head sub id" from logs and return it in the status message, improving clarity in subscription state reporting. This update complements existing functionality for tracking last subscription ID, ensuring comprehensive log analysis. --- checker.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/checker.py b/checker.py index 0ac3658..a89af00 100644 --- a/checker.py +++ b/checker.py @@ -140,15 +140,27 @@ def check_logs(logger): log_content = clean_ansi(logs.stdout) last_subscription_id = None + head_sub_id = None + for line in log_content.splitlines(): if "Ignored subscription creation" in line and "id=" in line: id_match = re.search(r'id=(\d+)', line) if id_match: last_subscription_id = id_match.group(1) + + if "head sub id is:" in line: + id_match = re.search(r'head sub id is:\s*(\d+)', line) + if id_match: + head_sub_id = id_match.group(1) + if head_sub_id: + logger.info(f"Head sub id: {head_sub_id}") + return {"status": f"OK: {head_sub_id}"} + if last_subscription_id: logger.info(f"Subscription: {last_subscription_id}") return {"status": f"Sync: {last_subscription_id}"} + logger.info("Not found subscription") return {"status": "Idle"}