summaryrefslogtreecommitdiff
path: root/redis/asyncio/cluster.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/asyncio/cluster.py')
-rw-r--r--redis/asyncio/cluster.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/redis/asyncio/cluster.py b/redis/asyncio/cluster.py
index 3fe3ebc..8dfb1cb 100644
--- a/redis/asyncio/cluster.py
+++ b/redis/asyncio/cluster.py
@@ -879,10 +879,18 @@ class ClusterNode:
await connection.send_packed_command(connection.pack_command(*args), False)
# Read response
+ return await asyncio.shield(
+ self._parse_and_release(connection, args[0], **kwargs)
+ )
+
+ async def _parse_and_release(self, connection, *args, **kwargs):
try:
- return await self.parse_response(connection, args[0], **kwargs)
+ return await self.parse_response(connection, *args, **kwargs)
+ except asyncio.CancelledError:
+ # should not be possible
+ await connection.disconnect(nowait=True)
+ raise
finally:
- # Release connection
self._free.append(connection)
async def execute_pipeline(self, commands: List["PipelineCommand"]) -> bool: