Commit 92d13b01 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Rewrite shutdown() a bit.

- Merge sys.exit()
- Remove exit message
- Move out of loop the code that should run once
- Add an XXX

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2139 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f658d4ae
......@@ -493,21 +493,22 @@ class Application(object):
node.getConnection().setHandler(handler)
# wait for all transaction to be finished
while True:
while self.tm.hasPending():
self.em.poll(1)
if self.tm.hasPending():
continue
if self.cluster_state == ClusterStates.RUNNING:
sys.exit("Application has been asked to shut down")
if self.cluster_state != ClusterStates.RUNNING:
logging.info("asking all nodes to shutdown")
# This code sends packets but never polls, so they never reach
# network.
for node in self.nm.getIdentifiedList():
notification = Packets.NotifyNodeInformation([node.asTuple()])
if node.isClient():
node.notify(notification)
elif node.isStorage() or node.isMaster():
node.notify(notification)
# then shutdown
sys.exit("Cluster has been asked to shut down")
sys.exit()
def identifyStorageNode(self, uuid, node):
state = NodeStates.RUNNING
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment