mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[PR #21011] [MERGED] perf: eliminate redundant SELECT after UPDATE in users.py #113196
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/21011
Author: @Classic298
Created: 1/28/2026
Status: ✅ Merged
Merged: 1/29/2026
Merged by: @tjbck
Base:
dev← Head:user-select📝 Commits (1)
2434bb4perf: eliminate redundant SELECT after UPDATE in users.py📊 Changes
1 file changed (+27 additions, -21 deletions)
View changed files
📝
backend/open_webui/models/users.py(+27 -21)📄 Description
Summary
Eliminates redundant database queries in 5 update methods in users.py. Previously, each method called update() followed by a separate query().first() to return the updated object.
Changes
models/users.py - 5 methods updated to use fetch-modify-refresh pattern:
Each method now:
Performance Impact
Before: 2 queries per update (UPDATE + SELECT)
After: 1 query + commit + refresh on same object
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.