[fix] restart gap
This commit is contained in:
parent
770af1fe76
commit
50af62b3fb
10 changed files with 348 additions and 4 deletions
|
|
@ -11,6 +11,12 @@ class InMemorySandboxSessionRepository(SandboxSessionRepository):
|
|||
self._sessions_by_chat_id: dict[UUID, SandboxSession] = {}
|
||||
self._lock = threading.Lock()
|
||||
|
||||
def replace_all(self, sessions: list[SandboxSession]) -> None:
|
||||
with self._lock:
|
||||
self._sessions_by_chat_id = {
|
||||
session.chat_id: session for session in sessions
|
||||
}
|
||||
|
||||
def get_active_by_chat_id(self, chat_id: UUID) -> SandboxSession | None:
|
||||
with self._lock:
|
||||
return self._sessions_by_chat_id.get(chat_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue