Commit f88d9684 authored by Jérome Perrin's avatar Jérome Perrin

Lower priority of mass workflow transition activity

We had an incident in a in instance were a user changed state of 70K invoices using https://www.erp5.com/howto/erp5-developer-howto/erp5-HowTo.Change.Workflow.State.Of.Multiple.Documents  and leads to user not receiving the reports they requested.

`Folder_modifyWorkflowStatus` creates a lot of `callMethodOnObjectList` activities (for all the selected documents) with priority 2, then these activities will cause more reindex an expand activities.

Until all these `callMethodOnObjectList` are processed, no new activities with priority > 2 were processed. Some "important for users" activities such as erp5_deferred_style reports where waiting in the queue.

I believe we should just set a lower priority to these `callMethodOnObjectList`, eventhough I considered a more clever way of giving the priority:

 - if the number of selected documents is reasonably small, process them with a very high priority, this way the user can see his document changing state almost immediately as when using the synchronous change state. This should not cause congestion because there are not too many documents.
 - when there are a lot of selected documents, process them with a very low priority, because anyway it will take time and user will not "wait" for documents to change state.

... but I realized this is trying to be too clever.

So any objections to just lower priority here ?

/reviewed-on nexedi/erp5!235
parents cb9d0c70 af9f0743
......@@ -70,7 +70,9 @@ path_list = [brain.path for brain in
portal.portal_selections.callSelectionFor(selection_name, params=selection_params)]
batch_size = 100 # XXX
priority = 2 # XXX
# We want change state activities to have a lower priority that erp5_deferred_style reports
# not to prevent everybody from running report while a users change state of many documents.
priority = 3
path_list_len = len(path_list)
for i in xrange(0, path_list_len, batch_size):
......
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