Skip to content

Commit a16aaa6

Browse files
committed
Pre-initialize restart locks for clients in GeminiClientPool
1 parent a18fc81 commit a16aaa6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/services/pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self) -> None:
3131
self._clients.append(client)
3232
self._id_map[c.id] = client
3333
self._round_robin.append(client)
34+
self._restart_locks[c.id] = asyncio.Lock() # Pre-initialize
3435

3536
async def init(self) -> None:
3637
"""Initialize all clients in the pool."""
@@ -73,8 +74,7 @@ async def _ensure_client_ready(self, client: GeminiClientWrapper) -> bool:
7374

7475
lock = self._restart_locks.get(client.id)
7576
if lock is None:
76-
lock = asyncio.Lock()
77-
self._restart_locks[client.id] = lock
77+
return False # Should not happen
7878

7979
async with lock:
8080
if client.running:

0 commit comments

Comments
 (0)