Skip to content

Commit 06fadbc

Browse files
committed
connection.connect() now has its own retry, don't need it inside a retry loop
1 parent 3dc6ddd commit 06fadbc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

redis/asyncio/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,19 +756,19 @@ async def parse_response(self, block: bool = True, timeout: float = 0):
756756

757757
await self.check_health()
758758

759-
async def try_read():
760-
if not conn.is_connected:
761-
await conn.connect()
762-
if not block:
759+
if not conn.is_connected:
760+
await conn.connect()
761+
762+
if not block:
763+
async def read_with_timeout():
763764
try:
764765
async with async_timeout.timeout(timeout):
765766
return await conn.read_response()
766767
except asyncio.TimeoutError:
767768
return None
768-
else:
769-
return await conn.read_response()
770-
771-
response = await self._execute(conn, try_read)
769+
response = await self._execute(conn, read_with_timeout)
770+
else:
771+
response = await self._execute(conn, conn.read_response)
772772

773773
if conn.health_check_interval and response == self.health_check_response:
774774
# ignore the health check message as user might not expect it

0 commit comments

Comments
 (0)