From 70442ccdc6e1850f80d66b12b022b9bb2c77320e Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Wed, 10 Jun 2026 21:26:09 +0000 Subject: [PATCH] t3-probe: fix aiohttp 3.9 compat (ClientWSTimeout is 3.10+) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bound connection establishment via session ClientTimeout(total=None, connect=15) instead — works on 3.9 through current; total must stay None or the session timeout would kill the long-lived probe WS. Verified by a local 14s smoke run: cloudflare + internal legs both connect. --- stacks/t3code/probe.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stacks/t3code/probe.py b/stacks/t3code/probe.py index ea3da93b..120daf35 100644 --- a/stacks/t3code/probe.py +++ b/stacks/t3code/probe.py @@ -128,10 +128,13 @@ async def ws_leg(leg, resolver): reason = "connect_failed" try: connector = aiohttp.TCPConnector(resolver=resolver, force_close=True) - async with aiohttp.ClientSession(connector=connector) as session: - async with session.ws_connect( - url, timeout=aiohttp.ClientWSTimeout(ws_close=10), heartbeat=None - ) as ws: + # total=None: a session-level total timeout would kill the + # long-lived WS; only connection establishment is bounded. + async with aiohttp.ClientSession( + connector=connector, + timeout=aiohttp.ClientTimeout(total=None, connect=15, sock_connect=15), + ) as session: + async with session.ws_connect(url, heartbeat=None) as ws: established = time.monotonic() attempts = 0 CONNECTED.labels(leg).set(1)