Commit 6e195902 authored by Vincent Pelletier's avatar Vincent Pelletier

Oops, second part of commit 19087: there are 2 places to fix in SQLDict,...

Oops, second part of commit 19087: there are 2 places to fix in SQLDict, oposed to just 1 in SQLQueue.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19088 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ca06768
...@@ -434,20 +434,6 @@ class SQLDict(RAMDict, SQLBase): ...@@ -434,20 +434,6 @@ class SQLDict(RAMDict, SQLBase):
endTransaction() endTransaction()
except: except:
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()) 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('SQLDict', PANIC, 'Failed to free remaining messages: %r' % (failed_message_uid_list, ), error=sys.exc_info())
else:
LOG('SQLDict', TRACE, 'Freed messages %r' % (failed_message_uid_list, ))
if endTransaction == abortTransactionSynchronously: if endTransaction == abortTransactionSynchronously:
LOG('SQLDict', PANIC, 'Failed to abort executed messages. Some objects may be modified accidentally.') LOG('SQLDict', PANIC, 'Failed to abort executed messages. Some objects may be modified accidentally.')
else: else:
...@@ -455,7 +441,14 @@ class SQLDict(RAMDict, SQLBase): ...@@ -455,7 +441,14 @@ class SQLDict(RAMDict, SQLBase):
abortTransactionSynchronously() abortTransactionSynchronously()
except: except:
LOG('SQLDict', PANIC, 'Failed to abort executed messages which also failed to commit. Some objects may be modified accidentally.') LOG('SQLDict', PANIC, 'Failed to abort executed messages which also failed to commit. Some objects may be modified accidentally.')
return True # Stop processing messages for this tic call for this queue. return True # Stop processing messages for this tic call for this queue.
failed_message_uid_list = [x[0] for x in message_uid_priority_list]
try:
makeMessageListAvailable(failed_message_uid_list)
except:
LOG('SQLDict', PANIC, 'Failed to free remaining messages: %r' % (failed_message_uid_list, ), error=sys.exc_info())
else:
LOG('SQLDict', TRACE, 'Freed messages %r' % (failed_message_uid_list, ))
self.finalizeMessageExecution(activity_tool, message_uid_priority_list) self.finalizeMessageExecution(activity_tool, message_uid_priority_list)
get_transaction().commit() get_transaction().commit()
return not len(message_uid_priority_list) return not len(message_uid_priority_list)
......
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