Search code examples
ruby-on-railsasynchronoussidekiq

Maintaining different concurrency for different queues in Sidekiq?


How can multiple instances of a specific worker be prevented from being executed via sidekiq asynchronously, also, i do not want to stop other processess from being executed asynchronously at the same time. How do i deal with this ? I do not want to restrict my concurrency for all type of workers/processes in sidekiq.


Solution

  • Checkout the sidekiq-limit_fetch gem, which you can use to limit the number of jobs that are executed in a particular queue.

    You can create a new queue for the job that you want executing one at a time, and give it a limit of one. This way you'll still be able to submit jobs to queue, but guarantee only one of them will be executing at a given time.