open-webui/backend
Classic298 99f2549289 fix: drop cached base models on every instance when a connection changes
With ENABLE_BASE_MODELS_CACHE on and more than one instance behind the load balancer, editing an OpenAI or Ollama connection only refreshes the instance that served the admin request. Every other instance keeps handing out the model list it cached before the edit, so a newly added model appears for some users and not others, and a removed one lingers. With MODELS_CACHE_TTL left empty the per-provider cache never expires either, so those instances stay wrong until they are restarted.

A provider config change now bumps an epoch stored in the config table, and each instance drops its cached base models when the epoch it last stamped no longer matches. The database is the only thing every deployment shares, and the key rides along in the config query get_all_models already makes, so this costs no extra round trip.

The direct /openai/models and /ollama/api/tags endpoints still answer from their own provider cache without checking the epoch, a window of MODELS_CACHE_TTL and one second by default. The model list users actually see, /api/models, is covered.
2026-08-27 23:28:57 +02:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
open_webui fix: drop cached base models on every instance when a connection changes 2026-08-27 23:28:57 +02:00
.dockerignore fix: litellm config issue 2024-02-24 22:35:11 -08:00
.gitignore refac 2024-09-06 04:59:20 +02:00
dev.sh perf: allow disabling websocket per-message-deflate (#28613) 2026-08-24 18:46:07 -04:00
requirements-min.txt perf: optional orjson JSON codec behind ENABLE_ORJSON (#27583) 2026-07-27 03:45:37 -04:00
requirements.txt chore: python-docx dep 2026-08-25 11:59:37 -04:00
start.sh perf: allow disabling websocket per-message-deflate (#28613) 2026-08-24 18:46:07 -04:00
start_windows.bat perf: allow disabling websocket per-message-deflate (#28613) 2026-08-24 18:46:07 -04:00