Skip to content

Commit b9af374

Browse files
authored
Fix connection health check for protocol != 2 when auth credentials are provided and health check interval is configured (#3477)
1 parent 805848a commit b9af374

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

redis/asyncio/connection.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ async def on_connect(self) -> None:
363363
self._parser.on_connect(self)
364364
if len(auth_args) == 1:
365365
auth_args = ["default", auth_args[0]]
366-
await self.send_command("HELLO", self.protocol, "AUTH", *auth_args)
366+
# avoid checking health here -- PING will fail if we try
367+
# to check the health prior to the AUTH
368+
await self.send_command(
369+
"HELLO", self.protocol, "AUTH", *auth_args, check_health=False
370+
)
367371
response = await self.read_response()
368372
if response.get(b"proto") != int(self.protocol) and response.get(
369373
"proto"

redis/connection.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,11 @@ def on_connect(self):
440440
self._parser.on_connect(self)
441441
if len(auth_args) == 1:
442442
auth_args = ["default", auth_args[0]]
443-
self.send_command("HELLO", self.protocol, "AUTH", *auth_args)
443+
# avoid checking health here -- PING will fail if we try
444+
# to check the health prior to the AUTH
445+
self.send_command(
446+
"HELLO", self.protocol, "AUTH", *auth_args, check_health=False
447+
)
444448
self.handshake_metadata = self.read_response()
445449
# if response.get(b"proto") != self.protocol and response.get(
446450
# "proto"

0 commit comments

Comments
 (0)