[PR #23794] [MERGED] perf(users): drop redundant get_user_by_id refetch in session-user endpoints #82244

Closed
opened 2026-05-13 16:43:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23794
Author: @Classic298
Created: 4/16/2026
Status: Merged
Merged: 4/17/2026
Merged by: @tjbck

Base: devHead: claude/remove-user-double-fetch


📝 Commits (3)

  • 35ca09f perf(users): drop redundant get_user_by_id refetch in session-user endpoints
  • 921658d fix(users): preserve USER_NOT_FOUND error on status update failure
  • 32aa70f docs(users): note lost-update tradeoff on /user/info/update

📊 Changes

1 file changed (+21 additions, -46 deletions)

View changed files

📝 backend/open_webui/routers/users.py (+21 -46)

📄 Description

Five /user/* handlers refetched the user row via Users.get_user_by_id(user.id) immediately after receiving an identical UserModel from Depends(get_verified_user). Since get_verified_user already populated the user within the same request microseconds earlier, the refetch is pure overhead. The dead else branches (unreachable — get_verified_user raises 401 on missing user) are removed as a natural consequence.

Affected endpoints:

  • GET /user/settings
  • GET /user/status
  • POST /user/status/update
  • GET /user/info
  • POST /user/info/update

Eliminates one SELECT per request to each of these endpoints with no behavioral change.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23794 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 4/16/2026 **Status:** ✅ Merged **Merged:** 4/17/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `claude/remove-user-double-fetch` --- ### 📝 Commits (3) - [`35ca09f`](https://github.com/open-webui/open-webui/commit/35ca09fd47eee50577b23ba6e573d364237731c6) perf(users): drop redundant get_user_by_id refetch in session-user endpoints - [`921658d`](https://github.com/open-webui/open-webui/commit/921658df1daccc6d40d41736d78baad2ed4be723) fix(users): preserve USER_NOT_FOUND error on status update failure - [`32aa70f`](https://github.com/open-webui/open-webui/commit/32aa70fbec18357276f99b019adb94511a008573) docs(users): note lost-update tradeoff on /user/info/update ### 📊 Changes **1 file changed** (+21 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/users.py` (+21 -46) </details> ### 📄 Description Five /user/* handlers refetched the user row via Users.get_user_by_id(user.id) immediately after receiving an identical UserModel from Depends(get_verified_user). Since get_verified_user already populated the user within the same request microseconds earlier, the refetch is pure overhead. The dead else branches (unreachable — get_verified_user raises 401 on missing user) are removed as a natural consequence. Affected endpoints: - GET /user/settings - GET /user/status - POST /user/status/update - GET /user/info - POST /user/info/update Eliminates one SELECT per request to each of these endpoints with no behavioral change. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [X] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-13 16:43:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#82244