[Erp5-report] r19076 - /erp5/trunk/products/CMFActivity/Activity/SQLQueue.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 5 19:13:53 CET 2008


Author: vincent
Date: Tue Feb  5 19:13:52 2008
New Revision: 19076

URL: http://svn.erp5.org?rev=19076&view=rev
Log:
Abort transaction before doing anything else: if it was transaction commit which raised, the transaction object will refuse subsequent "join" calls. Add some zope transation backward compatibility black magic and you get a TM instance which gets stalled in "registered" state while no transaction knows it.

Modified:
    erp5/trunk/products/CMFActivity/Activity/SQLQueue.py

Modified: erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLQueue.py?rev=19076&r1=19075&r2=19076&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLQueue.py Tue Feb  5 19:13:52 2008
@@ -284,11 +284,17 @@
             # This message failed, revert.
             abortTransactionSynchronously()
         except:
+          LOG('SQLQueue', WARNING, 'Exception raised when invoking message (uid, path, method_id) %r' % ((value[0], value[1].object_path, value[1].method_id), ), error=sys.exc_info())
+          try:
+            abortTransactionSynchronously()
+          except:
+            # Unfortunately, database adapters may raise an exception against abort.
+            LOG('SQLQueue', PANIC, 'abort failed, thus some objects may be modified accidentally')
+            return True # Stop processing messages for this tic call for this queue.
           # We must make sure that the message is not set as executed.
           # It is possible that the message is executed but the commit
           # of the transaction fails
           value[1].is_executed = 0
-          LOG('SQLQueue', WARNING, 'Exception raised when invoking message (uid, path, method_id) %r' % ((value[0], value[1].object_path, value[1].method_id), ), error=sys.exc_info())
           try:
             # Rollback all changes made on activity connection.
             # We will commit to make messages available, and we cannot control
@@ -302,12 +308,6 @@
             LOG('SQLQueue', PANIC, 'Failed to free message: %r' % (value, ), error=sys.exc_info())
           else:
             LOG('SQLQueue', TRACE, 'Freed message %r' % (value, ))
-          try:
-            abortTransactionSynchronously()
-          except:
-            # Unfortunately, database adapters may raise an exception against abort.
-            LOG('SQLQueue', PANIC, 'abort failed, thus some objects may be modified accidentally')
-            return True # Stop processing messages for this tic call for this queue.
         if time() > processing_stop_time:
           LOG('SQLQueue', TRACE, 'Stop processing message batch because processing delay exceeded')
           break




More information about the Erp5-report mailing list