Skip to content

Commit

Permalink
Reverted change in test_auth: we'll replace the default node only for…
Browse files Browse the repository at this point in the history
… commands we allow to retry on
  • Loading branch information
barshaul committed Nov 20, 2022
1 parent f8060b7 commit 81a29ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions redis/cluster.py
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/test_cluster.py
Expand Up @@ -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
Expand Down

0 comments on commit 81a29ae

Please sign in to comment.