Skip to content

Commit

Permalink
commands: add retries to ctdb-must-have-nodes command
Browse files Browse the repository at this point in the history
Signed-off-by: John Mulligan <[email protected]>
  • Loading branch information
phlogistonjohn committed Sep 3, 2024
1 parent 7b361bf commit b267218
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions sambacc/commands/ctdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,16 @@ def ctdb_must_have_node(ctx: Context) -> None:
expected_pnn = np.node_number or 0
waiter = np.cluster_meta_waiter()

limiter = ErrorLimiter("ctdb_must_have_node", 10, pause_func=waiter.wait)
while True:
if ctdb.pnn_in_cluster_meta(
cmeta=np.cluster_meta(),
pnn=expected_pnn,
):
break
_logger.info("node not yet ready")
waiter.wait()
with limiter.catch():
if ctdb.pnn_in_cluster_meta(
cmeta=np.cluster_meta(),
pnn=expected_pnn,
):
break
_logger.info("node not yet ready")
waiter.wait()
if ctx.cli.write_nodes:
_logger.info("Writing nodes file")
ctdb.cluster_meta_to_nodes(np.cluster_meta(), dest=np.persistent_path)
Expand Down

0 comments on commit b267218

Please sign in to comment.