Commit 2d0a1323 authored by Vincent Pelletier's avatar Vincent Pelletier

Move transaction commit inside "try" block.

Fix SQLQueue_rollback acquisition context.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18507 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 09564feb
...@@ -375,7 +375,6 @@ class SQLDict(RAMDict, SQLBase): ...@@ -375,7 +375,6 @@ class SQLDict(RAMDict, SQLBase):
else: else:
method = activity_tool.invoke method = activity_tool.invoke
args = (message_list[0], ) args = (message_list[0], )
try:
# Commit right before executing messages. # Commit right before executing messages.
# As MySQL transaction do no start exactly at the same time as ZODB # As MySQL transaction do no start exactly at the same time as ZODB
# transactions but a bit later, messages available might be called # transactions but a bit later, messages available might be called
...@@ -385,6 +384,7 @@ class SQLDict(RAMDict, SQLBase): ...@@ -385,6 +384,7 @@ class SQLDict(RAMDict, SQLBase):
# everything needed from MySQL to get a fresh view of ZODB objects. # everything needed from MySQL to get a fresh view of ZODB objects.
get_transaction().commit() get_transaction().commit()
# Try to invoke # Try to invoke
try:
method(*args) method(*args)
except: except:
LOG('SQLDict', WARNING, 'Exception raised when invoking 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, 'Exception raised when invoking 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())
...@@ -396,7 +396,7 @@ class SQLDict(RAMDict, SQLBase): ...@@ -396,7 +396,7 @@ class SQLDict(RAMDict, SQLBase):
# connection. As the transaction failed, we must rollback these # connection. As the transaction failed, we must rollback these
# potential changes before being allowed to commit in # potential changes before being allowed to commit in
# makeMessageListAvailable. # makeMessageListAvailable.
self.SQLDict_rollback() activity_tool.SQLDict_rollback()
makeMessageListAvailable(to_free_uid_list) makeMessageListAvailable(to_free_uid_list)
except: except:
LOG('SQLDict', PANIC, 'Failed to free messages: %r' % (to_free_uid_list, ), error=sys.exc_info()) LOG('SQLDict', PANIC, 'Failed to free 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