Commit 10191b8e authored by Vincent Pelletier's avatar Vincent Pelletier

Call SQLDict_rollback/SQLQueue_rollback before makeMessageListAvailable....

Call SQLDict_rollback/SQLQueue_rollback before makeMessageListAvailable. Similar fix is already applied to activity failure error path, but not to activity commit/abort error path.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18999 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 98fa8891
......@@ -443,6 +443,13 @@ class SQLDict(RAMDict, SQLBase):
LOG('SQLDict', WARNING, 'Failed to end transaction for messages (uid, path, method_id) %r' % ([(x[0], x[1].object_path, x[1].method_id) for x in message_uid_priority_list], ), error=sys.exc_info())
failed_message_uid_list = [x[0] for x in message_uid_priority_list]
try:
# Rollback all changes made on activity connection.
# We will commit to make messages available, and we cannot control
# what was done by the activity: it might have used the activity
# connection. As the transaction failed, we must rollback these
# potential changes before being allowed to commit in
# makeMessageListAvailable.
activity_tool.SQLDict_rollback()
makeMessageListAvailable(failed_message_uid_list)
except:
LOG('SQQueue', PANIC, 'Failed to free remaining messages: %r' % (failed_message_uid_list, ), error=sys.exc_info())
......
......@@ -316,6 +316,13 @@ class SQLQueue(RAMQueue, SQLBase):
to_free_uid_list = [x[0] for x in message_uid_priority_list if x[0] not in processed_uid_set]
if len(to_free_uid_list):
try:
# Rollback all changes made on activity connection.
# We will commit to make messages available, and we cannot control
# what was done by the activity: it might have used the activity
# connection. As the transaction failed, we must rollback these
# potential changes before being allowed to commit in
# makeMessageListAvailable.
activity_tool.SQLQueue_rollback()
makeMessageListAvailable(to_free_uid_list)
except:
LOG('SQQueue', PANIC, 'Failed to free remaining messages: %r' % (to_free_uid_list, ), error=sys.exc_info())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment