Fix: Add timeout on websocket accept (#4169)

This commit is contained in:
tofarr
2024-10-02 10:51:12 -06:00
committed by GitHub
parent e93db80769
commit e0f8a5d508

View File

@@ -1,3 +1,4 @@
import asyncio
import os
import re
import tempfile
@@ -257,7 +258,7 @@ async def websocket_endpoint(websocket: WebSocket):
{"action": "finish", "args": {}}
```
"""
await websocket.accept()
await asyncio.wait_for(websocket.accept(), 10)
if websocket.query_params.get('token'):
token = websocket.query_params.get('token')