ruby-on-railsresque

How to add a rate limit to a Resque queue?


So I have a Resque worker that calls an API, the issue is the API has a rate limit of 2 requests per second.

Is there a way to add a delay between each job processed in a specific queue?

P.S. the queue could have thousands of pending jobs.


Solution

  • Per my comment, I'd recommend just performing a sleep for a given number of seconds at the end of each Resque process method.