mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-25 17:22:55 +00:00
perf: Refine the Model Manager code (#3093)
This commit is contained in:
parent
1db8577ca6
commit
8cf66b9eca
|
|
@ -23,8 +23,10 @@ class ModelManage:
|
|||
model_instance = ModelManage.cache.get(_id)
|
||||
if model_instance is None:
|
||||
with _lock:
|
||||
model_instance = get_model(_id)
|
||||
ModelManage.cache.set(_id, model_instance, timeout=60 * 60 * 8)
|
||||
model_instance = ModelManage.cache.get(_id)
|
||||
if model_instance is None:
|
||||
model_instance = get_model(_id)
|
||||
ModelManage.cache.set(_id, model_instance, timeout=60 * 60 * 8)
|
||||
else:
|
||||
if model_instance.is_cache_model():
|
||||
ModelManage.cache.touch(_id, timeout=60 * 60 * 8)
|
||||
|
|
|
|||
Loading…
Reference in New Issue