Commit 91160071 authored by Vincent Pelletier's avatar Vincent Pelletier

Call rollback before commiting when in an error path.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18467 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 332d6801
......@@ -390,6 +390,13 @@ class SQLDict(RAMDict, SQLBase):
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())
to_free_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.
self.SQLDict_rollback()
makeMessageListAvailable(to_free_uid_list)
except:
LOG('SQLDict', PANIC, 'Failed to free messages: %r' % (to_free_uid_list, ), error=sys.exc_info())
......
......@@ -274,6 +274,13 @@ class SQLQueue(RAMQueue, SQLBase):
value[1].is_executed = 0
LOG('SQLQueue', WARNING, 'Exception raised when invoking message (uid, path, method_id) %r' % (value, ), error=sys.exc_info())
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.
self.SQLQueue_rollback()
makeMessageListAvailable([value[0]])
except:
LOG('SQQueue', PANIC, 'Failed to free message: %r' % (value, ), error=sys.exc_info())
......
<dtml-comment>
title:
connection_id:cmf_activity_sql_connection
max_rows:1000
max_cache:0
cache_time:0
class_name:
class_file:
</dtml-comment>
<params></params>
ROLLBACK
<dtml-comment>
title:
connection_id:cmf_activity_sql_connection
max_rows:1000
max_cache:0
cache_time:0
class_name:
class_file:
</dtml-comment>
<params></params>
ROLLBACK
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