diff --git a/checker.py b/checker.py index fdb03be..07f3a25 100644 --- a/checker.py +++ b/checker.py @@ -123,14 +123,18 @@ def check_logs(log_handler): except subprocess.CalledProcessError as e: raise RuntimeError(f"Error running docker logs: {e}") from e - subscription_pattern = r'Ignored subscription creation.*id=(\d+).*err=Subscription completed' - match = re.search(subscription_pattern, log_content) - if match: - subscription_id = match.group(1) - log_handler.info(f"Found subscription completion message, id: {subscription_id}") - return {"status": f"Subscription {subscription_id}"} + subscription_pattern = r'Ignored subscription creation.*id=(\d+)' + matches = re.finditer(subscription_pattern, log_content) + last_id = None - log_handler.info("No subscription completion message found") + for match in matches: + last_id = match.group(1) + + if last_id: + log_handler.info(f"Found last subscription message, id: {last_id}") + return {"status": f"Subscription {last_id}"} + + log_handler.info("No subscription message found") return {"status": "Idle"} if __name__ == "__main__":