server/session.py
branchstable
changeset 2319 654decb099e3
parent 2306 95da5d9f0870
child 2466 c4ccfd38a542
child 2570 80a996bb536d
--- a/server/session.py	Tue Jul 07 14:29:09 2009 +0200
+++ b/server/session.py	Wed Jul 08 07:44:41 2009 +0200
@@ -146,13 +146,16 @@
         return self._threaddata.pool
 
     def reset_pool(self):
-        """the session has no longer using its pool, at least for some time"""
+        """the session is no longer using its pool, at least for some time"""
         # pool may be none if no operation has been done since last commit
         # or rollback
         if self.pool is not None and self.mode == 'read':
             # even in read mode, we must release the current transaction
             pool = self.pool
-            self._threads_in_transaction.remove(threading.currentThread())
+            try:
+                self._threads_in_transaction.remove(threading.currentThread())
+            except KeyError:
+                pass
             pool.pool_reset()
             self._threaddata.pool = None
             # free pool once everything is done to avoid race-condition