[Zope-Checkins] SVN: Zope/trunk/ - Collector #1661: wire up 'python-check-interval'.

Tres Seaver tseaver at zope.com
Fri Jan 14 14:51:08 EST 2005


Log message for revision 28833:
   - Collector #1661:  wire up 'python-check-interval'.

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Zope/Startup/__init__.py
  U   Zope/trunk/lib/python/Zope/Startup/tests/testStarter.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-01-14 19:33:24 UTC (rev 28832)
+++ Zope/trunk/doc/CHANGES.txt	2005-01-14 19:51:08 UTC (rev 28833)
@@ -51,6 +51,10 @@
 
     Bugs fixed
 
+      - Collector #1661: make 'python-check-interval' setting in zope.conf
+        actually work as documented.  This setting allows for important
+        tuning opportunities for production Zope servers.
+
       - Collector #1657:  Don't break host-based virtual hosting when
         purging an HTTP accelerator.
 

Modified: Zope/trunk/lib/python/Zope/Startup/__init__.py
===================================================================
--- Zope/trunk/lib/python/Zope/Startup/__init__.py	2005-01-14 19:33:24 UTC (rev 28832)
+++ Zope/trunk/lib/python/Zope/Startup/__init__.py	2005-01-14 19:51:08 UTC (rev 28833)
@@ -94,6 +94,7 @@
         self.dropPrivileges()
         self.makeLockFile()
         self.makePidFile()
+        self.setupInterpreter()
         self.startZope()
         self.registerSignals()
         # emit a "ready" message in order to prevent the kinds of emails
@@ -306,7 +307,11 @@
             except OSError:
                 pass
 
+    def setupInterpreter(self):
+        """ make changes to the python interpreter environment """
+        sys.setcheckinterval(self.cfg.python_check_interval)
 
+
 class WindowsZopeStarter(ZopeStarter):
 
     def registerSignals(self):

Modified: Zope/trunk/lib/python/Zope/Startup/tests/testStarter.py
===================================================================
--- Zope/trunk/lib/python/Zope/Startup/tests/testStarter.py	2005-01-14 19:33:24 UTC (rev 28832)
+++ Zope/trunk/lib/python/Zope/Startup/tests/testStarter.py	2005-01-14 19:51:08 UTC (rev 28833)
@@ -356,6 +356,22 @@
             starter.unlinkPidFile()
             self.failIf(os.path.exists(name))
 
+    def testConfigureInterpreter(self):
+        import sys
+        oldcheckinterval = sys.getcheckinterval()
+        newcheckinterval = oldcheckinterval + 1
+        conf = self.load_config_text("""
+                    instancehome <<INSTANCE_HOME>>
+                    python-check-interval %d
+                    """ %  newcheckinterval  
+        )
+        try:
+            starter = self.get_starter(conf)
+            starter.setupInterpreter()
+            self.failUnlessEqual( sys.getcheckinterval() , newcheckinterval )
+        finally:
+            sys.setcheckinterval(oldcheckinterval)
+
     def testZopeRunConfigure(self):
         old_config = getConfiguration()
         try:



More information about the Zope-Checkins mailing list