From 1d4f083b109cb7aeb2c78c0e45bb4a7d466c3ba5 Mon Sep 17 00:00:00 2001 From: hmo Date: Sun, 19 Jul 2026 09:12:15 +0800 Subject: [PATCH] fix: use 10s timeout for remote service HTTP checks --- gateway/scripts/agents_health_check.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gateway/scripts/agents_health_check.py b/gateway/scripts/agents_health_check.py index 4f250cc..491dd65 100644 --- a/gateway/scripts/agents_health_check.py +++ b/gateway/scripts/agents_health_check.py @@ -87,6 +87,11 @@ def http_check(url, timeout=5): return (False, str(e)[:60]) +def http_check_remote(url, timeout=10): + """远程 HTTP 检查,超时更长(跨网)。""" + return http_check(url, timeout=timeout) + + def write_todo(name, issue, fix_script, fix_args, fix_cwd): """写一条 TODO 给 self_todo_executor 消费。 JSONL 每行一条,含 service/issue/时间/fix_action。 @@ -138,7 +143,8 @@ def main(): # 3. HTTP health check(远程服务直接用 HTTP 判断) http_msg = "" if port_ok or is_remote: - ok, detail = http_check(svc["health_url"]) + checker = http_check_remote if is_remote else http_check + ok, detail = checker(svc["health_url"]) # accept 401/403 as healthy if configured if not ok and svc.get("accept_401") and ("401" in detail or "403" in detail): http_msg = "auth (alive)"