sidekiq-throttled icon indicating copy to clipboard operation
sidekiq-throttled copied to clipboard

Consider job end in threshold throttling

Open philippevezina opened this issue 2 years ago • 1 comments

Currently, using the threshold strategy, the throttling is based on when the job is picked up by the worker. It doesn't take into consideration whether the job is actually done.

In many cases, this is not problematic, but if you want a very precise throttling (ex. for API calls) this could be more important. Let's say that I have a job that I want to throttle to 1 per second, but 1 job ends up taking 5 seconds, I could easily end up with 2 jobs executing at the same time.

I would be interested in having the threshold time apply only at the end of job and not when it is picked up.

I might need this for a project so I would be willing to work on this if the interest is here.

I would also like people's input on whether this should be the standard behaviour or rather an option.

philippevezina avatar Nov 19 '21 05:11 philippevezina

I'm open to suggestions.

ixti avatar May 30 '23 02:05 ixti