MCPcopy Create free account
hub / github.com/OpenDCAI/Paper2Any / __init__

Method __init__

fastapi_app/interprocess_lock.py:26–30  ·  view source on GitHub ↗
(self, name: str, limit: int = 1, poll_interval: float = 0.2)

Source from the content-addressed store, hash-verified

24 """A small file-lock based semaphore that works across uvicorn workers."""
25
26 def __init__(self, name: str, limit: int = 1, poll_interval: float = 0.2) -> None:
27 safe_name = re.sub(r"[^A-Za-z0-9._-]+", "_", (name or "").strip()).strip("._")
28 self._name = safe_name or "lock"
29 self._limit = max(1, int(limit))
30 self._poll_interval = max(0.05, float(poll_interval))
31
32 def _slot_path(self, index: int) -> Path:
33 return LOCK_ROOT / f"{self._name}.{index}.lock"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected