diff options
Diffstat (limited to 'redis/asyncio/cluster.py')
-rw-r--r-- | redis/asyncio/cluster.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/redis/asyncio/cluster.py b/redis/asyncio/cluster.py index 5a2dffd..569a076 100644 --- a/redis/asyncio/cluster.py +++ b/redis/asyncio/cluster.py @@ -1002,10 +1002,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: |