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): ...@@ -320,6 +320,7 @@ class SQLDict(RAMDict, SQLBase):
final_error_uid_list = [] final_error_uid_list = []
make_available_uid_list = [] make_available_uid_list = []
message_with_active_process_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) 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: for uid, m, priority in message_uid_priority_list:
if m.is_executed: if m.is_executed:
...@@ -334,7 +335,7 @@ class SQLDict(RAMDict, SQLBase): ...@@ -334,7 +335,7 @@ class SQLDict(RAMDict, SQLBase):
issubclass(m.exc_type, ConflictError): issubclass(m.exc_type, ConflictError):
delay_uid_list.append(uid) delay_uid_list.append(uid)
elif priority > MAX_PRIORITY: elif priority > MAX_PRIORITY:
m.notifyUser(activity_tool) notify_user_list.append(m)
final_error_uid_list.append(uid) final_error_uid_list.append(uid)
else: else:
try: try:
...@@ -372,6 +373,8 @@ class SQLDict(RAMDict, SQLBase): ...@@ -372,6 +373,8 @@ class SQLDict(RAMDict, SQLBase):
LOG('SQLDict', PANIC, 'Failed to unreserve %r' % (make_available_uid_list, ), error=sys.exc_info()) LOG('SQLDict', PANIC, 'Failed to unreserve %r' % (make_available_uid_list, ), error=sys.exc_info())
else: else:
LOG('SQLDict', TRACE, 'Freed messages %r' % (make_available_uid_list, )) 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: for m in message_with_active_process_list:
active_process = activity_tool.unrestrictedTraverse(m.active_process) active_process = activity_tool.unrestrictedTraverse(m.active_process)
if not active_process.hasActivity(): if not active_process.hasActivity():
......
...@@ -191,6 +191,7 @@ class SQLQueue(RAMQueue, SQLBase): ...@@ -191,6 +191,7 @@ class SQLQueue(RAMQueue, SQLBase):
delay_uid_list = [] delay_uid_list = []
final_error_uid_list = [] final_error_uid_list = []
message_with_active_process_list = [] message_with_active_process_list = []
notify_user_list = []
for uid, m, priority in message_uid_priority_list: for uid, m, priority in message_uid_priority_list:
if m.is_executed: if m.is_executed:
deletable_uid_list.append(uid) deletable_uid_list.append(uid)
...@@ -201,7 +202,7 @@ class SQLQueue(RAMQueue, SQLBase): ...@@ -201,7 +202,7 @@ class SQLQueue(RAMQueue, SQLBase):
issubclass(m.exc_type, ConflictError): issubclass(m.exc_type, ConflictError):
delay_uid_list.append(uid) delay_uid_list.append(uid)
elif priority > MAX_PRIORITY: elif priority > MAX_PRIORITY:
m.notifyUser(activity_tool) notify_user_list.append(m)
final_error_uid_list.append(uid) final_error_uid_list.append(uid)
else: else:
try: try:
...@@ -243,6 +244,8 @@ class SQLQueue(RAMQueue, SQLBase): ...@@ -243,6 +244,8 @@ class SQLQueue(RAMQueue, SQLBase):
processing_node=INVOKE_ERROR_STATE) processing_node=INVOKE_ERROR_STATE)
except: except:
LOG('SQLQueue', WARNING, 'Failed to set message to error state for %r' % (final_error_uid_list, ), error=sys.exc_info()) 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: for m in message_with_active_process_list:
active_process = activity_tool.unrestrictedTraverse(m.active_process) active_process = activity_tool.unrestrictedTraverse(m.active_process)
if not active_process.hasActivity(): 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