Files
open-webui/backend/open_webui
Classic298 c436e0366c perf: async DB calls, skip intermediate status writes, elif chain in event emitter (#22107)
Three improvements to the socket event emitter hot path (when realtime chat save is enabled):

1. Wrap all synchronous Chats.* DB calls in asyncio.to_thread() to avoid blocking the event loop during streaming. With N concurrent users, sync DB calls serialize all writes and block socket event delivery.

2. Only persist final (done=True) status events to DB. Intermediate statuses (tool calling progress, web search progress, etc.) are ephemeral UI-only data already delivered via socket — writing every one to DB is unnecessary I/O.

3. Convert if/if/if chain to if/elif since event types are mutually exclusive, avoiding unnecessary string comparisons after a match.
2026-03-01 13:43:03 -05:00
..
2026-02-11 16:24:11 -06:00
2026-02-28 17:08:41 -06:00
2026-02-25 15:15:59 -06:00
2026-02-22 18:42:25 -06:00
2026-02-28 21:28:59 -06:00
2026-02-11 16:24:11 -06:00
2026-02-21 14:19:28 -06:00
2026-02-19 14:06:24 -06:00
2026-03-01 12:32:44 -06:00
2026-02-28 13:07:10 -06:00
2026-02-25 15:15:59 -06:00
2026-02-11 16:24:11 -06:00
2026-02-28 21:28:59 -06:00
2026-02-12 15:29:34 -06:00