Commit 15308c68 authored by Julien Muchembled's avatar Julien Muchembled

storage: teach shutdown to close all connections

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2735 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d9bf64e1
...@@ -362,8 +362,10 @@ class Application(object): ...@@ -362,8 +362,10 @@ class Application(object):
def shutdown(self, erase=False): def shutdown(self, erase=False):
"""Close all connections and exit""" """Close all connections and exit"""
for c in self.em.getConnectionList(): for c in self.em.getConnectionList():
if not c.isListening(): try:
c.close() c.close()
except PrimaryFailure:
pass
# clear database to avoid polluting the cluster at restart # clear database to avoid polluting the cluster at restart
self.dm.setup(reset=erase) self.dm.setup(reset=erase)
sys.exit("Application has been asked to shut down") sys.exit("Application has been asked to shut down")
...@@ -51,11 +51,6 @@ class BaseMasterHandler(EventHandler): ...@@ -51,11 +51,6 @@ class BaseMasterHandler(EventHandler):
neo.lib.logging.info("I was told I'm %s" %(state)) neo.lib.logging.info("I was told I'm %s" %(state))
if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN, if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN,
NodeStates.BROKEN): NodeStates.BROKEN):
try:
conn.close()
assert False
except PrimaryFailure:
pass
erase = state == NodeStates.DOWN erase = state == NodeStates.DOWN
self.app.shutdown(erase=erase) self.app.shutdown(erase=erase)
elif state == NodeStates.HIDDEN: elif state == NodeStates.HIDDEN:
......
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