Skip to content

Commit 3953ac3

Browse files
committed
Remove now unnecessary lock from testing
1 parent 95693c8 commit 3953ac3

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

redis/asyncio/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,9 @@ async def _disconnect_reset_raise(self, conn, error):
13831383
# indicates the user should retry this transaction.
13841384
if self.watching:
13851385
await self.aclose()
1386-
raise
1386+
raise WatchError(
1387+
"A ConnectionError occurred on while watching one or more keys"
1388+
)
13871389
# if retry_on_error is not set or the error is not one
13881390
# of the specified error types, raise it
13891391
if (

redis/asyncio/connection.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,20 +1157,19 @@ async def disconnect(self, inuse_connections: bool = True):
11571157
current in use, potentially by other tasks. Otherwise only disconnect
11581158
connections that are idle in the pool.
11591159
"""
1160-
async with self._lock:
1161-
if inuse_connections:
1162-
connections: Iterable[AbstractConnection] = chain(
1163-
self._available_connections, self._in_use_connections
1164-
)
1165-
else:
1166-
connections = self._available_connections
1167-
resp = await asyncio.gather(
1168-
*(connection.disconnect() for connection in connections),
1169-
return_exceptions=True,
1160+
if inuse_connections:
1161+
connections: Iterable[AbstractConnection] = chain(
1162+
self._available_connections, self._in_use_connections
11701163
)
1171-
exc = next((r for r in resp if isinstance(r, BaseException)), None)
1172-
if exc:
1173-
raise exc
1164+
else:
1165+
connections = self._available_connections
1166+
resp = await asyncio.gather(
1167+
*(connection.disconnect() for connection in connections),
1168+
return_exceptions=True,
1169+
)
1170+
exc = next((r for r in resp if isinstance(r, BaseException)), None)
1171+
if exc:
1172+
raise exc
11741173

11751174
async def aclose(self) -> None:
11761175
"""Close the pool, disconnecting all connections"""

0 commit comments

Comments
 (0)