[publisher] avoid useless rollback after successful commit, which clutters debug logs and may also not be cost-free stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 02 Jul 2010 14:46:09 +0200
branchstable
changeset 5865 af414723598d
parent 5864 9b7c11e80d20
child 5866 e676a869a3e9
[publisher] avoid useless rollback after successful commit, which clutters debug logs and may also not be cost-free
web/application.py
--- a/web/application.py	Fri Jul 02 14:44:23 2010 +0200
+++ b/web/application.py	Fri Jul 02 14:46:09 2010 +0200
@@ -374,6 +374,7 @@
         # remove user callbacks on a new request (except for json controllers
         # to avoid callbacks being unregistered before they could be called)
         tstart = clock()
+        commited = False
         try:
             try:
                 ctrlid, rset = self.url_resolver.process(req, path)
@@ -391,6 +392,7 @@
                     # displaying some anonymous enabled view such as the cookie
                     # authentication form
                     req.cnx.commit()
+                    commited = True
             except (StatusResponse, DirectResponse):
                 if req.cnx:
                     req.cnx.commit()
@@ -434,7 +436,7 @@
                 self.critical('Catch all triggered!!!')
                 self.exception('this is what happened')
         finally:
-            if req.cnx:
+            if req.cnx and not commited:
                 try:
                     req.cnx.rollback()
                 except: