[feat] change str id type to UUID

This commit is contained in:
Azamat 2026-04-02 23:09:04 +03:00
parent e629e34c4d
commit 770af1fe76
11 changed files with 150 additions and 173 deletions

View file

@ -1,6 +1,7 @@
import threading
from types import TracebackType
from typing import Protocol
from uuid import UUID
from usecase.interface import LockContext, SandboxLifecycleLocker
@ -31,9 +32,9 @@ class _ChatLock(LockContext):
class ProcessLocalSandboxLifecycleLocker(SandboxLifecycleLocker):
def __init__(self) -> None:
self._registry_lock = threading.Lock()
self._locks_by_chat_id: dict[str, _SyncLock] = {}
self._locks_by_chat_id: dict[UUID, _SyncLock] = {}
def lock(self, chat_id: str) -> LockContext:
def lock(self, chat_id: UUID) -> LockContext:
with self._registry_lock:
lock = self._locks_by_chat_id.get(chat_id)
if lock is None: