Unverified Commit b43f1441 authored by Yeuoly's avatar Yeuoly Committed by GitHub

Fix/model runtime (#1873)

parent 5a2aa830
...@@ -33,10 +33,13 @@ class XinferenceHelper: ...@@ -33,10 +33,13 @@ class XinferenceHelper:
@staticmethod @staticmethod
def _clean_cache() -> None: def _clean_cache() -> None:
with cache_lock: try:
for model_uid, model in cache.items(): with cache_lock:
if model['expires'] < time(): expired_keys = [model_uid for model_uid, model in cache.items() if model['expires'] < time()]
for model_uid in expired_keys:
del cache[model_uid] del cache[model_uid]
except RuntimeError as e:
pass
@staticmethod @staticmethod
def _get_xinference_extra_parameter(server_url: str, model_uid: str) -> XinferenceModelExtraParameter: def _get_xinference_extra_parameter(server_url: str, model_uid: str) -> XinferenceModelExtraParameter:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment