Reputation: 900
I saw the Sidekiq allows me to assign a worker to a specific queue. What I want is to be able to tell the worker during enqueueing which queue to run in (vs. setting this globally on the worker).
Is this possible?
The case scenario: During my daily update jobs for my data, I want to enqueue this method in a low priority queue. When a new user comes into the system and I want to update his data immediately I want to call the same method but run it in a priority queue.
Do I have to create 2 different workers?
Thanks in advance!
Upvotes: 0
Views: 452
Reputation: 22228
Easy, just use the lower-level Sidekiq::Client
API instead of perform_async
:
Sidekiq::Client.push('class' => MyWorker, 'args' => [1, 2, 3], 'queue' => 'low')
Upvotes: 4