From 81a29aee40ef51cd81b174722cc44de29ca5b086 Mon Sep 17 00:00:00 2001 From: Bar Shaul Date: Sun, 20 Nov 2022 18:54:27 +0200 Subject: [PATCH] Reverted change in test_auth: we'll replace the default node only for commands we allow to retry on --- redis/cluster.py | 6 +++--- tests/test_cluster.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/redis/cluster.py b/redis/cluster.py index 9726ab93b1..1e8bbf8583 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -1057,10 +1057,10 @@ def execute_command(self, *args, **kwargs): # Return the processed result return self._process_result(args[0], res, **kwargs) except Exception as e: - if is_default_node: - # Replace the default cluster node - self.replace_default_node() if retry_attempts > 0 and type(e) in self.__class__.ERRORS_ALLOW_RETRY: + if is_default_node: + # Replace the default cluster node + self.replace_default_node() # The nodes and slots cache were reinitialized. # Try again with the new cluster setup. retry_attempts -= 1 diff --git a/tests/test_cluster.py b/tests/test_cluster.py index 4cc2f5f103..43aeb9e045 100644 --- a/tests/test_cluster.py +++ b/tests/test_cluster.py @@ -813,8 +813,6 @@ def raise_connection_error(): nodes = r.cluster_nodes() assert "myself" not in nodes.get(curr_default_node.name).get("flags") assert r.get_default_node() != curr_default_node - # Rollback to the old default node - r.replace_default_node(curr_default_node) @pytest.mark.onlycluster