[Bugfix] Catch asyncio.TimeoutError so duplex serving starts on Python 3.10 (#7412)
Signed-off-by: Tianyao Wu <rayroy31@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Alicia <115451386+congw729@users.noreply.github.com>
This commit is contained in:
6 files changed
+76
-4
No files matched your search
@@ -28,7 +28,8 @@ async def receive_text_with_timeout(websocket: WebSocket, timeout_s: float | Non
|
||||
return await websocket.receive_text()
|
||||
try:
|
||||
return await asyncio.wait_for(websocket.receive_text(), timeout=timeout_s)
|
||||
except TimeoutError:
|
||||
# asyncio.TimeoutError is not the builtin TimeoutError before Python 3.11.
|
||||
except (TimeoutError, asyncio.TimeoutError):
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user