mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #17587] [CLOSED] feat: use RedisDict for MODELS state when Redis is available #24479
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/17587
Author: @acwoo97
Created: 9/19/2025
Status: ❌ Closed
Base:
dev← Head:feat/models-in-multi-instance📝 Commits (1)
90d0cdafeat(models): use RedisDict for MODELS state when Redis is available📊 Changes
3 files changed (+29 additions, -5 deletions)
View changed files
📝
backend/open_webui/main.py(+12 -3)📝
backend/open_webui/socket/utils.py(+10 -0)📝
backend/open_webui/utils/models.py(+7 -2)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
MODELS) to replace the in-memory dictionary whenREDIS_URLis configured.replace_allinRedisDictusing Redis pipelines for atomic operations, preventing potential race conditions betweenDELETEandHSET.Added
RedisDict.replace_all(mapping)method with pipeline support (pipe.delete+pipe.hset+pipe.execute), ensuring atomic replacement of all model entries.Changed
app.state.MODELSinitialization now conditionally usesRedisDictinstead of plain{}when Redis is available.RedisDict.replace_allif using Redis storage, ensuring full state synchronization across instances.Deprecated
Removed
dictto manage models.Fixed
Security
Breaking Changes
app.state.MODELSis now backed by Redis instead of an in-memory dict, potentially changing persistence and runtime behavior.Additional Information
replace_allto ensure atomic state replacement and avoid transient states during delete/set operations.Screenshots or Videos
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.