mirror of
https://git.mirrors.martin98.com/https://github.com/open-webui/open-webui
synced 2025-08-18 05:25:53 +08:00
Merge pull request #13306 from tarmst/remove-blocking-websocket-awaits
Perf: Chat Websocket Sequential Awaits
This commit is contained in:
commit
f7f3ae7cc9
@ -314,16 +314,18 @@ def get_event_emitter(request_info, update_db=True):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for session_id in session_ids:
|
emit_tasks = [sio.emit(
|
||||||
await sio.emit(
|
"chat-events",
|
||||||
"chat-events",
|
{
|
||||||
{
|
"chat_id": request_info.get("chat_id", None),
|
||||||
"chat_id": request_info.get("chat_id", None),
|
"message_id": request_info.get("message_id", None),
|
||||||
"message_id": request_info.get("message_id", None),
|
"data": event_data,
|
||||||
"data": event_data,
|
},
|
||||||
},
|
to=session_id,
|
||||||
to=session_id,
|
)
|
||||||
)
|
for session_id in session_ids]
|
||||||
|
|
||||||
|
await asyncio.gather(*emit_tasks)
|
||||||
|
|
||||||
if update_db:
|
if update_db:
|
||||||
if "type" in event_data and event_data["type"] == "status":
|
if "type" in event_data and event_data["type"] == "status":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user