Skip to content

Changed the PubSub's health check command to be performed only on the… #1733

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

Closed
wants to merge 2 commits into from
Closed
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/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ def reset(self):
self.pending_unsubscribe_channels = set()
self.patterns = {}
self.pending_unsubscribe_patterns = set()
self.cmd_execution_health_check = True

def close(self):
self.reset()
Expand Down Expand Up @@ -1258,8 +1259,11 @@ def execute_command(self, *args):
# were listening to when we were disconnected
self.connection.register_connect_callback(self.on_connect)
connection = self.connection
kwargs = {'check_health': not self.subscribed}
kwargs = {'check_health': self.cmd_execution_health_check}
self._execute(connection, connection.send_command, *args, **kwargs)
if self.cmd_execution_health_check is True:
# Run a health check only on the first command execution
self.cmd_execution_health_check = False

def _disconnect_raise_connect(self, conn, error):
"""
Expand Down