Commit e1dc6942 authored by Vincent Pelletier's avatar Vincent Pelletier

Call notifyUser after doing activity state cleanup. This makes it less...

Call notifyUser after doing activity state cleanup. This makes it less problematic if it raises (activities are already in a clean state).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18985 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9e4362e6
......@@ -320,6 +320,7 @@ class SQLDict(RAMDict, SQLBase):
final_error_uid_list = []
make_available_uid_list = []
message_with_active_process_list = []
notify_user_list = []
something_failed = (len([x for x in message_uid_priority_list if not x[1].is_executed]) != 0)
for uid, m, priority in message_uid_priority_list:
if m.is_executed:
......@@ -334,7 +335,7 @@ class SQLDict(RAMDict, SQLBase):
issubclass(m.exc_type, ConflictError):
delay_uid_list.append(uid)
elif priority > MAX_PRIORITY:
m.notifyUser(activity_tool)
notify_user_list.append(m)
final_error_uid_list.append(uid)
else:
try:
......@@ -372,6 +373,8 @@ class SQLDict(RAMDict, SQLBase):
LOG('SQLDict', PANIC, 'Failed to unreserve %r' % (make_available_uid_list, ), error=sys.exc_info())
else:
LOG('SQLDict', TRACE, 'Freed messages %r' % (make_available_uid_list, ))
for m in notify_user_list:
m.notifyUser(activity_tool)
for m in message_with_active_process_list:
active_process = activity_tool.unrestrictedTraverse(m.active_process)
if not active_process.hasActivity():
......
......@@ -191,6 +191,7 @@ class SQLQueue(RAMQueue, SQLBase):
delay_uid_list = []
final_error_uid_list = []
message_with_active_process_list = []
notify_user_list = []
for uid, m, priority in message_uid_priority_list:
if m.is_executed:
deletable_uid_list.append(uid)
......@@ -201,7 +202,7 @@ class SQLQueue(RAMQueue, SQLBase):
issubclass(m.exc_type, ConflictError):
delay_uid_list.append(uid)
elif priority > MAX_PRIORITY:
m.notifyUser(activity_tool)
notify_user_list.append(m)
final_error_uid_list.append(uid)
else:
try:
......@@ -243,6 +244,8 @@ class SQLQueue(RAMQueue, SQLBase):
processing_node=INVOKE_ERROR_STATE)
except:
LOG('SQLQueue', WARNING, 'Failed to set message to error state for %r' % (final_error_uid_list, ), error=sys.exc_info())
for m in notify_user_list:
m.notifyUser(activity_tool)
for m in message_with_active_process_list:
active_process = activity_tool.unrestrictedTraverse(m.active_process)
if not active_process.hasActivity():
......
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