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,16 +375,16 @@ class SQLDict(RAMDict, SQLBase):
else:
method = activity_tool.invoke
args = (message_list[0], )
# Commit right before executing messages.
# As MySQL transaction do no start exactly at the same time as ZODB
# transactions but a bit later, messages available might be called
# on objects which are not available - or available in an old
# version - to ZODB connector.
# So all connectors must be commited now that we have selected
# everything needed from MySQL to get a fresh view of ZODB objects.
get_transaction().commit()
# Try to invoke
try:
# Commit right before executing messages.
# As MySQL transaction do no start exactly at the same time as ZODB
# transactions but a bit later, messages available might be called
# on objects which are not available - or available in an old
# version - to ZODB connector.
# So all connectors must be commited now that we have selected
# everything needed from MySQL to get a fresh view of ZODB objects.
get_transaction().commit()
# Try to invoke
method(*args)
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())
......@@ -396,7 +396,7 @@ class SQLDict(RAMDict, SQLBase):
# connection. As the transaction failed, we must rollback these
# potential changes before being allowed to commit in
# makeMessageListAvailable.
self.SQLDict_rollback()
activity_tool.SQLDict_rollback()
makeMessageListAvailable(to_free_uid_list)
except:
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