Commit 2ebdf299 authored by Yoshinori Okuji's avatar Yoshinori Okuji

If an exception but ConflictError happens when obtaining a message,

put the message into an error state immediately.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8166 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f4561d66
......@@ -291,8 +291,8 @@ class SQLDict(RAMDict):
# Release locks before starting a potentially long calculation
get_transaction().commit()
except:
# If an exception occurs, abort the transaction to minimize the impact,
except ConflictError:
# If a conflict occurs, abort the transaction to minimize the impact,
# then simply delay the operations.
get_transaction().abort()
for uid_list in uid_list_list:
......@@ -300,6 +300,13 @@ class SQLDict(RAMDict):
retry = 1)
get_transaction().commit()
return 0
except:
# For other exceptions, put the messages to an invalid state immediately.
get_transaction().abort()
for uid_list in uid_list_list:
activity_tool.SQLDict_assignMessage(uid = uid_list, processing_node = INVOKE_ERROR_STATE)
get_transaction().commit()
return 0
# Try to invoke
if group_method_id is not None:
......
......@@ -119,13 +119,20 @@ class SQLQueue(RAMQueue):
priority = line.priority)
get_transaction().commit() # Release locks before starting a potentially long calculation
return 0
except:
# If any exception occurs, catch it and delay the operation.
except ConflictError:
# If a conflict occurs, catch it and delay the operation.
get_transaction().abort()
activity_tool.SQLQueue_setPriority(uid = line.uid, date = next_processing_date,
priority = line.priority)
get_transaction().commit()
return 0
except:
# For the other exceptions, put it into an error state.
get_transaction().abort()
activity_tool.SQLQueue_assignMessage(uid = line.uid, processing_node = INVOKE_ERROR_STATE)
get_transaction().commit()
return 0
# Try to invoke
activity_tool.invoke(m) # Try to invoke the message - what happens if read conflict error restarts transaction ?
......
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