diff options
author | Chayim <chayim@users.noreply.github.com> | 2023-03-22 18:04:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 18:04:42 +0200 |
commit | 7b48b1bb34f97e4adf32c12a987ff593dc536aef (patch) | |
tree | 779459c3c1472e29f8e639877759d80dbed9b917 /redis/asyncio/cluster.py | |
parent | 54a1dce8cbe5b7082588e831e0db22f2aa6a5166 (diff) | |
download | redis-py-4.3.tar.gz |
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 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: |