Net: 8 s health-check timeout, show a dead proxy only after two misses

AmneziaWG 3 tunnels idle for a while need 5+ s for the first handshake, so the
4-5 s checks marked working connections as dead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-19 11:31:03 +03:00
parent 3c7931d710
commit 46901f2b62
3 changed files with 29 additions and 17 deletions
+3 -3
View File
@@ -108,13 +108,13 @@ def cmd_select(r):
def cmd_delay(r):
test = "url=" + q(TEST_URL) + "&timeout=5000"
test = "url=" + q(TEST_URL) + "&timeout=8000" # AmneziaWG 3 handshakes after idle can take 5+ s
if r.get("group") in DELAY_GROUPS:
return {"ok": True, "delays": api("GET", "/group/%s/delay?%s" % (q(r["group"]), test), timeout=10)}
return {"ok": True, "delays": api("GET", "/group/%s/delay?%s" % (q(r["group"]), test), timeout=15)}
if r.get("proxy") in CLIENT_TUNNELS:
try:
d = api("GET", "/providers/proxies/clients/%s/healthcheck?%s" % (q(r["proxy"]), test),
timeout=10).get("delay", 0)
timeout=15).get("delay", 0)
except Exception:
d = 0
return {"ok": True, "delays": {r["proxy"]: d}}