bench_standard: a socket TimeoutError is reported as timeout, like the timer (Windows reported connection_TimeoutError when the socket fired first)

This commit is contained in:
Niko1221 committed 2026-11-07 17:19:43 +01:00
1 parent 391f7ce8dc
commit e8c3acd2d1
1 file changed
+1 -1
+1 -1
View File
@@ -288,7 +288,7 @@ def stream_chat(target: Target, spec: dict, model: str | None, *, timeout_s: flo
raw["interrupted"] = True
raw["error"] = {"kind": "cancelled", "message": "cancelled by the operator"}
except (OSError, http.client.HTTPException, ValueError) as exc:
if raw["timed_out"]:
if raw["timed_out"] or isinstance(exc, TimeoutError): # the socket's own timeout can fire just before the timer does (Windows)
raw["error"] = {"kind": "timeout", "message": f"no complete answer within {timeout_s:g} seconds"}
else:
raw["error"] = {"kind": "connection_" + type(exc).__name__, "message": str(exc)[:200] or type(exc).__name__}