diff --git a/bin/nexus_watchdog.py b/bin/nexus_watchdog.py index f2f5cfa3..f6256724 100644 --- a/bin/nexus_watchdog.py +++ b/bin/nexus_watchdog.py @@ -586,8 +586,8 @@ def alert_on_failure(report: HealthReport, dry_run: bool = False) -> None: logger.info("Created alert issue #%d", result["number"]) -def run_once(args: argparse.Namespace) -> bool: - """Run one health check cycle. Returns True if healthy.""" +def run_once(args: argparse.Namespace) -> tuple: + """Run one health check cycle. Returns (healthy, report).""" report = run_health_checks( ws_host=args.ws_host, ws_port=args.ws_port, @@ -615,7 +615,7 @@ def run_once(args: argparse.Namespace) -> bool: except Exception: pass # never crash the watchdog over its own heartbeat - return report.overall_healthy + return report.overall_healthy, report def main(): @@ -678,21 +678,15 @@ def main(): signal.signal(signal.SIGINT, _handle_sigterm) while _running: - run_once(args) + run_once(args) # (healthy, report) — not needed in watch mode for _ in range(args.interval): if not _running: break time.sleep(1) else: - healthy = run_once(args) + healthy, report = run_once(args) if args.output_json: - report = run_health_checks( - ws_host=args.ws_host, - ws_port=args.ws_port, - heartbeat_path=Path(args.heartbeat_path), - stale_threshold=args.stale_threshold, - ) print(json.dumps({ "healthy": report.overall_healthy, "timestamp": report.timestamp,