@@ -841,7 +841,7 @@ async def _reset(
841841 if self .closed :
842842 return
843843
844- with self .lock :
844+ async with self .lock :
845845 if self .opts .pause_enabled and pause and not self .opts .load_balanced :
846846 old_state , self .state = self .state , PoolState .PAUSED
847847 self .gen .inc (service_id )
@@ -851,10 +851,10 @@ async def _reset(
851851 self .pid = newpid
852852
853853 self .active_sockets = 0
854- with self ._conns_lock :
854+ async with self ._conns_lock :
855855 if service_id is None :
856856 sockets , self .conns = self .conns , collections .deque ()
857- with self ._operation_count_lock :
857+ async with self ._operation_count_lock :
858858 self .operation_count = 0
859859 if service_id is not None :
860860 discard : collections .deque = collections .deque () # type: ignore[type-arg]
@@ -865,11 +865,11 @@ async def _reset(
865865 else :
866866 keep .append (conn )
867867 sockets = discard
868- with self ._conns_lock :
868+ async with self ._conns_lock :
869869 self .conns = keep
870870
871871 if close :
872- with self .lock :
872+ async with self .lock :
873873 self .state = PoolState .CLOSED
874874 # Clear the wait queue
875875 self ._max_connecting_cond .notify_all ()
@@ -1396,9 +1396,9 @@ async def checkin(self, conn: AsyncConnection) -> None:
13961396 if self .stale_generation (conn .generation , conn .service_id ):
13971397 close_conn = True
13981398 else :
1399- with self ._conns_lock :
1399+ async with self ._conns_lock :
14001400 self .conns .appendleft (conn )
1401- with self ._max_connecting_cond :
1401+ async with self ._max_connecting_cond :
14021402 # Notify any threads waiting to create a connection.
14031403 self ._max_connecting_cond .notify ()
14041404 if close_conn :
0 commit comments