Skip to content

Commit 101a652

Browse files
committed
Require connections to land in the correct pool
1 parent 481063b commit 101a652

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

redis/asyncio/connection.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,13 +1068,9 @@ def make_connection(self):
10681068
async def release(self, connection: AbstractConnection):
10691069
"""Releases the connection back to the pool"""
10701070
async with self._lock:
1071-
try:
1072-
self._in_use_connections.remove(connection)
1073-
except KeyError:
1074-
# Gracefully fail when a connection is returned to this pool
1075-
# that the pool doesn't actually own
1076-
pass
1077-
1071+
# Connections should always be returned to the correct pool,
1072+
# not doing so is an error that will cause an exception here.
1073+
self._in_use_connections.remove(connection)
10781074
self._available_connections.append(connection)
10791075

10801076
async def disconnect(self, inuse_connections: bool = True):

0 commit comments

Comments
 (0)