[Zope3-checkins] CVS: Zope3/src/ZODB - config.py:1.16

Tim Peters tim.one at comcast.net
Mon Mar 8 17:36:18 EST 2004


Update of /cvs-repository/Zope3/src/ZODB
In directory cvs.zope.org:/tmp/cvs-serv25864/src/ZODB

Modified Files:
	config.py 
Log Message:
ZODBDatabase.open():  if the call to ZODB.DB() fails (== raises an
exception), explicitly close the storage passed to it, then re-raise
the exception.  Otherwise the storage remains open.  Turns out that
accounted for why test_zeo_config left a ConnectThread daemon thread
running (Zope3's test.py has been pointing that out for a loooong time).


=== Zope3/src/ZODB/config.py 1.15 => 1.16 ===
--- Zope3/src/ZODB/config.py:1.15	Thu Oct  2 14:17:19 2003
+++ Zope3/src/ZODB/config.py	Mon Mar  8 17:36:17 2004
@@ -94,11 +94,16 @@
 
     def open(self):
         section = self.config
-        return ZODB.DB(section.storage.open(),
-                       pool_size=section.pool_size,
-                       cache_size=section.cache_size,
-                       version_pool_size=section.version_pool_size,
-                       version_cache_size=section.version_cache_size)
+        storage = section.storage.open()
+        try:
+            return ZODB.DB(storage,
+                           pool_size=section.pool_size,
+                           cache_size=section.cache_size,
+                           version_pool_size=section.version_pool_size,
+                           version_cache_size=section.version_cache_size)
+        except:
+            storage.close()
+            raise
 
 class MappingStorage(BaseConfig):
 




More information about the Zope3-Checkins mailing list