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

Abort transaction before doing anything else: if it was transaction commit...

Abort transaction before doing anything else: if it was transaction commit which raised, the transaction object will refuse subsequent "join" calls. Add some zope transation backward compatibility black magic and you get a TM instance which gets stalled in "registered" state while no transaction knows it.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19076 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f8384da3
......@@ -284,11 +284,17 @@ class SQLQueue(RAMQueue, SQLBase):
# This message failed, revert.
abortTransactionSynchronously()
except:
LOG('SQLQueue', WARNING, 'Exception raised when invoking message (uid, path, method_id) %r' % ((value[0], value[1].object_path, value[1].method_id), ), error=sys.exc_info())
try:
abortTransactionSynchronously()
except:
# Unfortunately, database adapters may raise an exception against abort.
LOG('SQLQueue', PANIC, 'abort failed, thus some objects may be modified accidentally')
return True # Stop processing messages for this tic call for this queue.
# We must make sure that the message is not set as executed.
# It is possible that the message is executed but the commit
# of the transaction fails
value[1].is_executed = 0
LOG('SQLQueue', WARNING, 'Exception raised when invoking message (uid, path, method_id) %r' % ((value[0], value[1].object_path, value[1].method_id), ), error=sys.exc_info())
try:
# Rollback all changes made on activity connection.
# We will commit to make messages available, and we cannot control
......@@ -302,12 +308,6 @@ class SQLQueue(RAMQueue, SQLBase):
LOG('SQLQueue', PANIC, 'Failed to free message: %r' % (value, ), error=sys.exc_info())
else:
LOG('SQLQueue', TRACE, 'Freed message %r' % (value, ))
try:
abortTransactionSynchronously()
except:
# Unfortunately, database adapters may raise an exception against abort.
LOG('SQLQueue', PANIC, 'abort failed, thus some objects may be modified accidentally')
return True # Stop processing messages for this tic call for this queue.
if time() > processing_stop_time:
LOG('SQLQueue', TRACE, 'Stop processing message batch because processing delay exceeded')
break
......
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