refactor: uv-based deps, no nexus auth, LLM retries, lock cleanup, health checks, e2e tests
This commit is contained in:
@@ -32,6 +32,19 @@ router = APIRouter(tags=["web"])
|
||||
_llm_locks: dict[int, asyncio.Lock] = {}
|
||||
_llm_lock = asyncio.Lock()
|
||||
|
||||
# Cleanup interval for unused LLM locks (30 minutes)
|
||||
_LLM_LOCK_CLEANUP_INTERVAL = 1800
|
||||
|
||||
|
||||
async def _cleanup_llm_locks():
|
||||
"""Periodically clean up unused LLM locks to prevent memory leaks."""
|
||||
while True:
|
||||
await asyncio.sleep(_LLM_LOCK_CLEANUP_INTERVAL)
|
||||
for key in list(_llm_locks.keys()):
|
||||
if not _llm_locks[key].locked():
|
||||
_llm_locks.pop(key, None)
|
||||
|
||||
|
||||
_jinja_env = Environment(
|
||||
loader=PackageLoader(APP_PACKAGE, "web/templates"),
|
||||
autoescape=select_autoescape(),
|
||||
|
||||
Reference in New Issue
Block a user