[Neo-report] r2735 jm - in /trunk/neo/storage: app.py handlers/__init__.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Apr 27 18:09:05 CEST 2011


Author: jm
Date: Wed Apr 27 18:09:05 2011
New Revision: 2735

Log:
storage: teach shutdown to close all connections

Modified:
    trunk/neo/storage/app.py
    trunk/neo/storage/handlers/__init__.py

Modified: trunk/neo/storage/app.py
==============================================================================
--- trunk/neo/storage/app.py [iso-8859-1] (original)
+++ trunk/neo/storage/app.py [iso-8859-1] Wed Apr 27 18:09:05 2011
@@ -362,8 +362,10 @@ class Application(object):
     def shutdown(self, erase=False):
         """Close all connections and exit"""
         for c in self.em.getConnectionList():
-            if not c.isListening():
+            try:
                 c.close()
+            except PrimaryFailure:
+                pass
         # clear database to avoid polluting the cluster at restart
         self.dm.setup(reset=erase)
         sys.exit("Application has been asked to shut down")

Modified: trunk/neo/storage/handlers/__init__.py
==============================================================================
--- trunk/neo/storage/handlers/__init__.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/__init__.py [iso-8859-1] Wed Apr 27 18:09:05 2011
@@ -51,11 +51,6 @@ class BaseMasterHandler(EventHandler):
                 neo.lib.logging.info("I was told I'm %s" %(state))
                 if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN,
                         NodeStates.BROKEN):
-                    try:
-                        conn.close()
-                        assert False
-                    except PrimaryFailure:
-                        pass
                     erase = state == NodeStates.DOWN
                     self.app.shutdown(erase=erase)
                 elif state == NodeStates.HIDDEN:




More information about the Neo-report mailing list