Allow single-node clusters to restart and timeout
Prevents a daemon from waiting forever to terminate if it is primary, and avoids this entirely if there is only a single node in the cluster.
This commit is contained in:
parent
07f2006f68
commit
45fc8a47a3
|
@ -233,11 +233,14 @@ def entrypoint():
|
||||||
|
|
||||||
# Force into secondary coordinator state if needed
|
# Force into secondary coordinator state if needed
|
||||||
try:
|
try:
|
||||||
if this_node.router_state == "primary":
|
if this_node.router_state == "primary" and len(d_node) > 1:
|
||||||
zkhandler.write([("base.config.primary_node", "none")])
|
zkhandler.write([("base.config.primary_node", "none")])
|
||||||
logger.out("Waiting for primary migration", state="s")
|
logger.out("Waiting for primary migration", state="s")
|
||||||
while this_node.router_state != "secondary":
|
timeout = 240
|
||||||
|
count = 0
|
||||||
|
while this_node.router_state != "secondary" and count < timeout:
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
|
count += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue