Skip to content

Commit 81a29ae

Browse files
committed
Reverted change in test_auth: we'll replace the default node only for commands we allow to retry on
1 parent f8060b7 commit 81a29ae

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

redis/cluster.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1057,10 +1057,10 @@ def execute_command(self, *args, **kwargs):
10571057
# Return the processed result
10581058
return self._process_result(args[0], res, **kwargs)
10591059
except Exception as e:
1060-
if is_default_node:
1061-
# Replace the default cluster node
1062-
self.replace_default_node()
10631060
if retry_attempts > 0 and type(e) in self.__class__.ERRORS_ALLOW_RETRY:
1061+
if is_default_node:
1062+
# Replace the default cluster node
1063+
self.replace_default_node()
10641064
# The nodes and slots cache were reinitialized.
10651065
# Try again with the new cluster setup.
10661066
retry_attempts -= 1

tests/test_cluster.py

-2
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,6 @@ def raise_connection_error():
813813
nodes = r.cluster_nodes()
814814
assert "myself" not in nodes.get(curr_default_node.name).get("flags")
815815
assert r.get_default_node() != curr_default_node
816-
# Rollback to the old default node
817-
r.replace_default_node(curr_default_node)
818816

819817

820818
@pytest.mark.onlycluster

0 commit comments

Comments
 (0)