open-webui/backend/open_webui
Thomas Rehn ce3a615442
perf: cache OpenAI config reads to avoid redundant Redis lookups in /api/models (#21306)
Each access to request.app.state.config.<KEY> triggers a synchronous
Redis GET. In get_all_models_responses() and get_merged_models(), the
config keys OPENAI_API_BASE_URLS, OPENAI_API_KEYS, and
OPENAI_API_CONFIGS were read on every loop iteration — resulting
in some cases in 200-300 Redis round-trips for OPENAI_API_BASE_URLS alone.

Read each config value once into a local variable at the start of the
function and reuse it throughout.
2026-02-11 17:59:50 -06:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal chore: format 2026-02-11 16:24:11 -06:00
migrations chore: format 2026-02-11 16:24:11 -06:00
models refac 2026-02-11 16:45:47 -06:00
retrieval chore: format 2026-02-11 16:24:11 -06:00
routers perf: cache OpenAI config reads to avoid redundant Redis lookups in /api/models (#21306) 2026-02-11 17:59:50 -06:00
socket chore: format 2026-02-11 16:24:11 -06:00
static refac 2025-08-10 00:02:58 +04:00
storage chore: format 2026-02-11 16:24:11 -06:00
test rm: outdated tests 2025-12-28 23:35:09 +04:00
tools chore: format 2026-02-11 16:24:11 -06:00
utils refac 2026-02-11 16:40:40 -06:00
__init__.py Update __init__.py 2025-04-15 09:55:35 +02:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py chore: format 2026-02-11 16:24:11 -06:00
constants.py feat/enh: optional password validation 2025-11-20 17:44:49 -05:00
env.py chore: format 2026-02-11 16:24:11 -06:00
functions.py chore: format 2026-02-11 16:24:11 -06:00
main.py refac 2026-02-11 16:40:40 -06:00
tasks.py chore: format 2026-02-11 16:24:11 -06:00