mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #24049] [CLOSED] perf: skip redundant function row fetches when warming module cache on /api/models #66349
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/24049
Author: @jmleksan
Created: 4/23/2026
Status: ❌ Closed
Base:
dev← Head:perf/batch-functions-call📝 Commits (1)
20515e2Enhance function module caching by allowing pre-fetched function rows to be passed, reducing redundant database queries.📊 Changes
2 files changed (+27 additions, -13 deletions)
View changed files
📝
backend/open_webui/utils/models.py(+6 -5)📝
backend/open_webui/utils/plugin.py(+21 -8)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.function=argument; defaults preserve existing behavior.)devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Changelog Entry
Description
get_functions_by_ids, then warms the function module cache by callingget_function_module_from_cacheonce per function ID. Previously, each of those calls issued anotherget_function_by_id(primary-keySELECT) even though the row was already loaded. This change allows callers to pass the preloadedFunctionModelso the warmup path avoids redundant per-ID database round-trips. Behavior for callers that omit the new argument is unchanged.Changed
get_function_module_from_cache(..., function: Optional[FunctionModel] = None): whenfunctionis provided withload_from_db=True, use the row’scontentand skipFunctions.get_function_by_id.get_all_modelswarmup loop: passfunction=function_rowfromfunctions_by_idintoget_function_module_from_cache; comment updated to describe batch row reuse.Additional Information
GET /api/modelsshowed many short, sequential PostgreSQL lookups onfunctionby primary key after anIN (...)batch load. Removing the duplicate reads reduces latency and connection-pool pressure when multiple actions/filters are referenced.function=still re-fetch from the DB as before.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.