Skip to content

Commit 1db8577

Browse files
authored
perf: Refine the Model Manager code (#3091)
1 parent 949e4de commit 1db8577

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

apps/common/config/embedding_config.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ def get_model(_id, get_model):
2525
with _lock:
2626
model_instance = get_model(_id)
2727
ModelManage.cache.set(_id, model_instance, timeout=60 * 60 * 8)
28-
ModelManage.clear_timeout_cache()
29-
return model_instance
3028
else:
3129
if model_instance.is_cache_model():
3230
ModelManage.cache.touch(_id, timeout=60 * 60 * 8)
33-
return model_instance
3431
else:
3532
model_instance = get_model(_id)
3633
ModelManage.cache.set(_id, model_instance, timeout=60 * 60 * 8)
37-
return model_instance
34+
ModelManage.clear_timeout_cache()
35+
return model_instance
3836

3937
@staticmethod
4038
def clear_timeout_cache():

0 commit comments

Comments
 (0)