refac
This commit is contained in:
1 parent
8adf2b33b4
commit
337109e99c
1 file changed
+3
@@ -639,6 +639,7 @@ async def lifespan(app: FastAPI):
|
|||||||
asyncio.create_task(periodic_session_pool_cleanup())
|
asyncio.create_task(periodic_session_pool_cleanup())
|
||||||
|
|
||||||
if app.state.config.ENABLE_BASE_MODELS_CACHE:
|
if app.state.config.ENABLE_BASE_MODELS_CACHE:
|
||||||
|
try:
|
||||||
await get_all_models(
|
await get_all_models(
|
||||||
Request(
|
Request(
|
||||||
# Creating a mock request object to pass to get_all_models
|
# Creating a mock request object to pass to get_all_models
|
||||||
@@ -658,6 +659,8 @@ async def lifespan(app: FastAPI):
|
|||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
log.warning(f"Failed to pre-fetch models at startup: {e}")
|
||||||
|
|
||||||
# Pre-fetch tool server specs so the first request doesn't pay the latency cost
|
# Pre-fetch tool server specs so the first request doesn't pay the latency cost
|
||||||
if len(app.state.config.TOOL_SERVER_CONNECTIONS) > 0:
|
if len(app.state.config.TOOL_SERVER_CONNECTIONS) > 0:
|
||||||
|
|||||||
Reference in new issue
Block a user