Add timeout for ZK stop

This commit is contained in:
Antonio Andelic 2023-01-03 09:59:06 +00:00
parent 4ccd828a44
commit a88171b594
2 changed files with 6 additions and 0 deletions

View File

@ -29,7 +29,10 @@ def start_zookeeper(node):
def stop_zookeeper(node):
node.exec_in_container(["bash", "-c", "/opt/zookeeper/bin/zkServer.sh stop"])
timeout = time.time() + 60
while node.get_process_pid("zookeeper") != None:
if time.time() > timeout:
raise Exception("Failed to stop ZooKeeper in 60 secs")
time.sleep(0.2)

View File

@ -24,7 +24,10 @@ def start_zookeeper():
def stop_zookeeper():
node.exec_in_container(["bash", "-c", "/opt/zookeeper/bin/zkServer.sh stop"])
timeout = time.time() + 60
while node.get_process_pid("zookeeper") != None:
if time.time() > timeout:
raise Exception("Failed to stop ZooKeeper in 60 secs")
time.sleep(0.2)