From f0d48a4295c30318e34b93a03c8f4b264573216a Mon Sep 17 00:00:00 2001 From: Algorithm5838 <108630393+Algorithm5838@users.noreply.github.com> Date: Tue, 24 Mar 2026 12:48:06 +0300 Subject: [PATCH] perf: use asyncio.to_thread for heartbeat DB write (#22980) --- backend/open_webui/socket/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index 1518193da..e308087a3 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -393,7 +393,7 @@ async def heartbeat(sid, data): user = SESSION_POOL.get(sid) if user: SESSION_POOL[sid] = {**user, 'last_seen_at': int(time.time())} - Users.update_last_active_by_id(user['id']) + await asyncio.to_thread(Users.update_last_active_by_id, user['id']) @sio.on('join-channels')