Commit addfd436 authored by Jean-Paul Smets's avatar Jean-Paul Smets

removed useless commits in flush


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@367 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fcacb518
...@@ -90,7 +90,7 @@ class SQLDict(RAMDict): ...@@ -90,7 +90,7 @@ class SQLDict(RAMDict):
get_transaction().commit() # Release locks before starting a potentially long calculation get_transaction().commit() # Release locks before starting a potentially long calculation
else: else:
# Try to invoke # Try to invoke
activity_tool.invoke(m) # Try to invoke the message activity_tool.invoke(m) # Try to invoke the message - what happens if read conflict error restarts transaction ?
if m.is_executed: # Make sure message could be invoked if m.is_executed: # Make sure message could be invoked
activity_tool.SQLDict_delMessage(path=path, method_id=method_id, activity_tool.SQLDict_delMessage(path=path, method_id=method_id,
processing_node=processing_node, processing=1) # Delete it processing_node=processing_node, processing=1) # Delete it
...@@ -134,7 +134,6 @@ class SQLDict(RAMDict): ...@@ -134,7 +134,6 @@ class SQLDict(RAMDict):
# LOG('Flush', 0, str((path, invoke, method_id))) # LOG('Flush', 0, str((path, invoke, method_id)))
if invoke: if invoke:
result = activity_tool.SQLDict_readMessageList(path=path, method_id=method_id,processing_node=None) result = activity_tool.SQLDict_readMessageList(path=path, method_id=method_id,processing_node=None)
if commit: get_transaction().commit() # Release locks before starting a potentially long calculation
method_dict = {} method_dict = {}
# Parse each message # Parse each message
for line in result: for line in result:
...@@ -146,20 +145,17 @@ class SQLDict(RAMDict): ...@@ -146,20 +145,17 @@ class SQLDict(RAMDict):
m = self.loadMessage(line.message) m = self.loadMessage(line.message)
# First Validate # First Validate
if m.validate(self, activity_tool): if m.validate(self, activity_tool):
activity_tool.invoke(m) # Try to invoke the message activity_tool.invoke(m) # Try to invoke the message - what happens if invoke calls flushActivity ??
if not m.is_executed: # Make sure message could be invoked if not m.is_executed: # Make sure message could be invoked
if commit: get_transaction().abort() # If not, abort transaction and start a new one
# The message no longer exists # The message no longer exists
raise ActivityFlushError, ( raise ActivityFlushError, (
'Could not evaluate %s on %s' % (method_id , path)) 'Could not evaluate %s on %s' % (method_id , path))
else: else:
if commit: get_transaction().abort() # If not, abort transaction and start a new one
# The message no longer exists # The message no longer exists
raise ActivityFlushError, ( raise ActivityFlushError, (
'The document %s does not exist' % path) 'The document %s does not exist' % path)
# Erase all messages in a single transaction # Erase all messages in a single transaction
activity_tool.SQLDict_delMessage(path=path, method_id=method_id) # Delete all activity_tool.SQLDict_delMessage(path=path, method_id=method_id) # Delete all "old" messages (not -1 processing)
if commit: get_transaction().commit() # Commit flush
def getMessageList(self, activity_tool, processing_node=None): def getMessageList(self, activity_tool, processing_node=None):
message_list = [] message_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