fix(ml): race condition when loading models (#3207)

* sync model loading, disabled model ttl by default

* disable revalidation if model unloading disabled

* moved lock
This commit is contained in:
Mert
2023-07-11 13:01:21 -04:00
committed by GitHub
parent 9ad024c189
commit 848ba685eb
3 changed files with 6 additions and 10 deletions

View File

@ -25,7 +25,7 @@ app = FastAPI()
def init_state() -> None:
app.state.model_cache = ModelCache(ttl=settings.model_ttl, revalidate=True)
app.state.model_cache = ModelCache(ttl=settings.model_ttl, revalidate=settings.model_ttl > 0)
async def load_models() -> None: