[Erp5-report] r18508 - /erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Dec 24 23:15:42 CET 2007
Author: vincent
Date: Mon Dec 24 23:15:42 2007
New Revision: 18508
URL: http://svn.erp5.org?rev=18508&view=rev
Log:
Fix commit being issued inconditionaly between activites: "regular" activity failure do *not* cause "invoke" to raise, but cause is_executed to be false.
Fix SQLQueue_rollback acquisition context.
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=18508&r1=18507&r2=18508&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLQueue.py Mon Dec 24 23:15:42 2007
@@ -262,11 +262,15 @@
# Try to invoke
try:
activity_tool.invoke(value[1])
- # Commit so that if a message raises it doesn't causes previous
- # successfull messages to be rolled back. This commit might fail,
- # so it is protected the same way as activity execution by the
- # same "try" block.
- get_transaction().commit()
+ if value[1].is_executed:
+ # Commit so that if a message raises it doesn't causes previous
+ # successfull messages to be rolled back. This commit might fail,
+ # so it is protected the same way as activity execution by the
+ # same "try" block.
+ get_transaction().commit()
+ else:
+ # This message failed, revert.
+ abortTransactionSynchronously()
except:
# We must make sure that the message is not set as executed.
# It is possible that the message is executed but the commit
@@ -280,7 +284,7 @@
# connection. As the transaction failed, we must rollback these
# potential changes before being allowed to commit in
# makeMessageListAvailable.
- self.SQLQueue_rollback()
+ activity_tool.SQLQueue_rollback()
makeMessageListAvailable([value[0]])
except:
LOG('SQQueue', PANIC, 'Failed to free message: %r' % (value, ), error=sys.exc_info())
More information about the Erp5-report
mailing list