Skip to content

Commit

Permalink
restart on endpoint change
Browse files Browse the repository at this point in the history
  • Loading branch information
paulomach committed Sep 12, 2024
1 parent 61a25a0 commit fffd50c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ def _on_database_created(self, _) -> None:

def _on_endpoints_changed(self, _) -> None:
"""Handle the database endpoints changed event."""
if self.is_writes_running:
logger.debug("Restarting continuous writes due to endpoints change")
self._stop_continuous_writes()
self._on_start_continuous_writes_action(None)
return

if self.config["auto_start_writes"]:
count = self._max_written_value()
self._start_continuous_writes(count + 1)
Expand Down

0 comments on commit fffd50c

Please sign in to comment.