mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[PR #24024] [MERGED] perf(chats): drop redundant db.refresh after commit in update_chat_by_id #114791
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24024
Author: @runixer
Created: 4/23/2026
Status: ✅ Merged
Merged: 4/24/2026
Merged by: @tjbck
Base:
dev← Head:perf/drop-refresh-update-chat-by-id📝 Commits (1)
4532a17perf(chats): drop redundant db.refresh after commit in update_chat_by_id📊 Changes
1 file changed (+0 additions, -1 deletions)
View changed files
📝
backend/open_webui/models/chats.py(+0 -1)📄 Description
Pull Request Checklist
devdev. I have not yet run 0.9.1 in production.devChangelog Entry
Chats.update_chat_by_idno longer issuesawait db.refresh(chat_item)aftercommit(). Thechattable has no server-side defaults, triggers, or computed columns, and every field the method modifies (chat,title,updated_at) is set explicitly from Python values. The refresh was round-tripping the entirechat.chatJSON blob over the wire and through the driver's JSON decoder without producing different data.Description
Hit during perf work on chats where
chat.chathad grown to tens of MB (long RAG-heavy conversations).db.refreshhere is pure overhead:DEFAULTclause, noSERIAL/IDENTITY, no triggers onchat(verified on PostgreSQL:SELECT * FROM pg_trigger WHERE tgrelid = 'chat'::regclass AND NOT tgisinternalis empty).metahasserver_default='{}'but that applies to INSERT only; UPDATE does not re-populate it, andupdate_chat_by_iddoes not touchmeta.All callers of
update_chat_by_idreturn the resultingChatModelimmediately and do not read fields that could change server-side.Testing
Patch running in our production fork since 2026-04-20 over a ~35k-row
chattable, no functional regressions. The tested path was the pre-async (sync) implementation; the single-line removal is semantically identical in the async variant ondev.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.