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 b3ab42a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 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
1 change: 0 additions & 1 deletion tests/test_asyncio/test_cluster.py
Expand Up @@ -800,7 +800,6 @@ async def test_default_node_is_replaced_after_exception(self, r):
# CLUSTER NODES command is being executed on the default node
nodes = await r.cluster_nodes()
assert "myself" in nodes.get(curr_default_node.name).get("flags")

# Mock connection error for the default node
mock_node_resp_exc(curr_default_node, ConnectionError("error"))
# Test that the command succeed from a different node
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 b3ab42a

Please sign in to comment.