Skip to content

Commit

Permalink
Revert Retrying configurations
Browse files Browse the repository at this point in the history
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
  • Loading branch information
marceloneppel committed Jun 24, 2024
1 parent 0148f1e commit 7ce1eab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def primary_endpoint(self) -> Optional[str]:
logger.debug("primary endpoint early exit: Peer relation not joined yet.")
return None
try:
for attempt in Retrying(stop=stop_after_delay(5), wait=wait_fixed(3)):
for attempt in Retrying(stop=stop_after_delay(60), wait=wait_fixed(3)):
with attempt:
primary = self._patroni.get_primary()
if primary is None and (standby_leader := self._patroni.get_standby_leader()):
Expand Down
2 changes: 1 addition & 1 deletion src/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def are_all_members_ready(self) -> bool:

def get_patroni_health(self) -> Dict[str, str]:
"""Gets, retires and parses the Patroni health endpoint."""
for attempt in Retrying(stop=stop_after_delay(60), wait=wait_fixed(7)):
for attempt in Retrying(stop=stop_after_delay(90), wait=wait_fixed(3)):
with attempt:
r = requests.get(
f"{self._patroni_url}/health",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_primary_endpoint(harness):
assert harness.charm.primary_endpoint == "1.1.1.1"

# Check needed to ensure a fast charm deployment.
_stop_after_delay.assert_called_once_with(5)
_stop_after_delay.assert_called_once_with(60)
_wait_fixed.assert_called_once_with(3)

_patroni.return_value.get_member_ip.assert_called_once_with(sentinel.primary)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def test_get_patroni_health(peers_ips, patroni):
health = patroni.get_patroni_health()

# Check needed to ensure a fast charm deployment.
_stop_after_delay.assert_called_once_with(60)
_wait_fixed.assert_called_once_with(7)
_stop_after_delay.assert_called_once_with(90)
_wait_fixed.assert_called_once_with(3)

tc.assertEqual(health, {"state": "running"})

Expand Down

0 comments on commit 7ce1eab

Please sign in to comment.