Add Redis-backed concurrency gate

This commit is contained in:
吉鑫升 committed 2026-06-30 11:25:44 +08:00
1 parent b0db8cc3d8
commit b4206d6421
12 files changed
+654 -46

No files matched your search

@@ -219,6 +219,7 @@ class RunManager:
multitask_strategy: str = "reject",
model_concurrency_limit: tuple[str, int] | None = None,
user_model_concurrency_limit: tuple[str, str, int] | None = None,
run_id: str | None = None,
) -> RunRecord:
"""Atomically check for inflight runs and create a new one.
@@ -229,7 +230,7 @@ class RunManager:
This method holds the lock across both the check and the insert,
eliminating the TOCTOU race in separate ``has_inflight`` + ``create``.
"""
run_id = str(uuid.uuid4())
run_id = run_id or str(uuid.uuid4())
now = _now_iso()
_supported_strategies = ("reject", "interrupt", "rollback")