[server/session] Roll back in connection exit
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 23 Jun 2015 10:02:41 +0200
changeset 10435 5b33ca2c61e0
parent 10434 8e04ab5582d9
child 10436 6493c8bf521d
[server/session] Roll back in connection exit This was changed in commit 8b35a898b334 "[server] remove cnxset tracking, it is now unneeded". When exiting a CubicWeb Connection, the database connection is put back into the common pool. At that point anything done during the lifetime of the CubicWeb Connection needs to be committed or rolled back. Do a proper rollback to finish the transaction, as was happening before the above-mentionned commit. This showed up on testing with postgresql, when a DB schema modification was blocked by an old connection that was still "in transaction".
server/session.py
--- a/server/session.py	Wed May 20 16:13:07 2015 +0200
+++ b/server/session.py	Tue Jun 23 10:02:41 2015 +0200
@@ -392,7 +392,7 @@
 
     def __exit__(self, exctype=None, excvalue=None, tb=None):
         assert self._open # actually already open
-        self.clear()
+        self.rollback()
         self._open = False
         self.cnxset.cnxset_freed()
         self.repo._free_cnxset(self.cnxset)