docs: say a connect timeout counts as a stall

This commit is contained in:
Abdessamad Derraz committed 2026-10-23 22:14:34 +02:00
1 parent c67dd2ad46
commit 19c57b3d68
1 file changed
+6 -3
+6 -3
View File
@@ -3328,13 +3328,16 @@ def install_bounded_opener() -> None:
# stuck proxy) held the run 93 s on three waits of 30 s. A list is a few
# MB, never a slow stream.
LIST_TIMEOUT = 15.0
# Attempts after a server that took the connection went silent: once more,
# a stall is rarely a blip.
# Attempts after a wait ran out, for the connection (a TLS handshake a
# captive portal never finishes) or for the answer once connected (a stuck
# proxy): once more, a stall is rarely a blip.
STALLED_ATTEMPTS = 2
def _stalled(exc: BaseException) -> bool:
"""Whether exc is a wait that ran out, the connection made."""
"""Whether exc is a wait that ran out: urllib raises a connect timeout
as a URLError whose reason is the timeout, a silent answer as the
timeout itself."""
reason = getattr(exc, "reason", None)
return isinstance(exc, socket.timeout) or isinstance(reason, socket.timeout)