[Zope-Checkins] CVS: Zope/lib/python/Signals - Signals.py:1.6

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 4 Nov 2002 08:33:48 -0500


Update of /cvs-repository/Zope/lib/python/Signals
In directory cvs.zope.org:/tmp/cvs-serv11475/lib/python/Signals

Modified Files:
	Signals.py 
Log Message:
clean shutdown

=== Zope/lib/python/Signals/Signals.py 1.5 => 1.6 ===
--- Zope/lib/python/Signals/Signals.py:1.5	Thu Oct 10 10:08:14 2002
+++ Zope/lib/python/Signals/Signals.py	Mon Nov  4 08:33:47 2002
@@ -21,9 +21,18 @@
 import zLOG
 import sys
 import ZLogger
+import Lifetime
+
+def shutdownFastHandler():
+    """Shutdown cleanly on SIGTERM. This is registered first,
+       so it should be called after all other handlers."""
+    closeall()
+    zLOG.LOG('Z2', zLOG.INFO , "Shutting down fast")
+    Lifetime.shutdown(0,fast=1)
+
 
 def shutdownHandler():
-    """Shutdown cleanly on SIGTERM, SIGINT. This is registered first,
+    """Shutdown cleanly on SIGINT. This is registered first,
        so it should be called after all other handlers."""
     closeall()
     zLOG.LOG('Z2', zLOG.INFO , "Shutting down")
@@ -34,7 +43,7 @@
        should be called after all other SIGHUP handlers."""
     closeall()
     zLOG.LOG('Z2', zLOG.INFO , "Restarting")
-    sys.exit(1)
+    Lifetime.shutdown(1)
 
 def logfileReopenHandler():
     """Reopen log files on SIGUSR2. This is registered first, so it
@@ -83,7 +92,7 @@
 
 def registerZopeSignals():
     import signal
-    SignalHandler.registerHandler(signal.SIGTERM, shutdownHandler)
+    SignalHandler.registerHandler(signal.SIGTERM, shutdownFastHandler)
     SignalHandler.registerHandler(signal.SIGINT, shutdownHandler)
     SignalHandler.registerHandler(signal.SIGHUP, restartHandler)
     SignalHandler.registerHandler(signal.SIGUSR2, logfileReopenHandler)