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

Chris McDonough chrism@zope.com
Wed, 28 Aug 2002 13:49:39 -0400


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

Modified Files:
	Signals.py 
Log Message:
Hook SIGUSR1 to pack the "main" database.


=== Zope/lib/python/Signals/Signals.py 1.2 => 1.3 ===
--- Zope/lib/python/Signals/Signals.py:1.2	Wed Aug 14 17:51:39 2002
+++ Zope/lib/python/Signals/Signals.py	Wed Aug 28 13:49:38 2002
@@ -56,6 +56,19 @@
     zLOG.LOG('Z2', zLOG.BLATHER, "Reopened event log")
     zLOG.LOG('Z2', zLOG.INFO, "Log files reopened successfully")
 
+def packHandler():
+    zLOG.LOG('Z2', zLOG.INFO, 'Packing main ZODB database')
+    import Globals
+    try:
+        db = Globals.opened[0]
+        db.pack()
+        zLOG.LOG('Z2', zLOG.INFO,
+                'Database packing launched or completed successfully')
+    except:
+        zLOG.LOG('Z2', zLOG.INFO,
+                 'Call to pack failed!', error=sys.exc_info())
+        
+
 def closeall():
     """Helper method to close network and database connections."""
     import Globals
@@ -76,3 +89,4 @@
     SignalHandler.registerHandler(signal.SIGINT, shutdownHandler)
     SignalHandler.registerHandler(signal.SIGHUP, restartHandler)
     SignalHandler.registerHandler(signal.SIGUSR2, logfileReopenHandler)
+    SignalHandler.registerHandler(signal.SIGUSR1, packHandler)