Dynamic Sidekiq priority job
By default sidekiq uses “Queue” to prioritize jobs: https://github.com/mperham/sidekiq/wiki/Advanced-Options Then you can configure workers to use “high priority” queue.
But can we dynamically decide which queue at runtime?
Instead of YourWorker.perform_async(arg1, arg2)
,
there’s a low-level API that you can use:
Sidekiq::Client.push( {
'class' => YourWorker,
'queue' => your_queue,
'args' => [arg1, arg2]
})
That way you can decide which queue to use, at runtime.