Skip to content

Fix connection health check for protocol != 2 when auth credentials are provided and health check interval is configured #3477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ async def on_connect(self) -> None:
self._parser.on_connect(self)
if len(auth_args) == 1:
auth_args = ["default", auth_args[0]]
await self.send_command("HELLO", self.protocol, "AUTH", *auth_args)
# avoid checking health here -- PING will fail if we try
# to check the health prior to the AUTH
await self.send_command(
"HELLO", self.protocol, "AUTH", *auth_args, check_health=False
)
response = await self.read_response()
if response.get(b"proto") != int(self.protocol) and response.get(
"proto"
Expand Down
6 changes: 5 additions & 1 deletion redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ def on_connect(self):
self._parser.on_connect(self)
if len(auth_args) == 1:
auth_args = ["default", auth_args[0]]
self.send_command("HELLO", self.protocol, "AUTH", *auth_args)
# avoid checking health here -- PING will fail if we try
# to check the health prior to the AUTH
self.send_command(
"HELLO", self.protocol, "AUTH", *auth_args, check_health=False
)
self.handshake_metadata = self.read_response()
# if response.get(b"proto") != self.protocol and response.get(
# "proto"
Expand Down
Loading