Implement throttling for queue processing

We’d like to have an option to specify that the work queue should process “one entry per minute”.

New tab on the work queue screen called Throttling

These new fileds from the WorkQueue entity will be edited here:

  • EnableThrottling
    not nullable, default false

  • ThrottlingIntervalSeconds
    not nullable, default 60

  • ThrottlingItemsPerInterval
    not nullable, default 10

Failed attempts will also count to the throttling limit.

Throttling attempts will be recorded in a separate entity WorkQueueState with fields:

  • refWorkQueueId
    not nullable

  • ThrottlingIntervalStart (Date)
    not nullable, default minDate

  • ThrottlingItemsProcessed
    not nullable, default 0

Sort WorkQueues by “Code”

Throttling interval 5 minutes, 100 items.
=> Process 100 items as fast as possible in 5 minutes. If they are done in the first second, wait for the rest of the interval… There will be no artificial waiting between the item processing

I think use case with pause after each item processed should be an option. We are using an 3rd party API, where we can post request once per 10 seconds. Now we are using wait task to achieve this. It would be great , if this could be configured in WQ itself.

@washi do you have any objections to making all the new fields non-nullable