You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But does not state how to implement this code. A few questions I have:
Where do I put this code?
How do I customize it?
Why is it needed?
The documentation is very bear bones and is not understandable as it is currently written. A brief explanation would do wonders for integrating this very helpful gem with activejob.
The text was updated successfully, but these errors were encountered:
Typically you put this in config/initializers/sidekiq.rb along with other Sidekiq configuration options. Of course it can be defined in other initializer files.
Depends on what you want to customize. The array that is returned in unique_args it a set of 'attributes' that define the uniqueness of a job. Think of it as a multicolumn unique index (constraint) in a database.
It is needed because you cannot use Sidekiq specific options defined per sidekiq worker in ActiveJob because ActiveJob is a simple wrapper and does not pass those option to underlying Sidekiq workers (via ActiveJob::JobWrapper). Therefore you have to define those options as default_sidekiq_options but then you lose the ability to control specific worker/job configuration. For more info see https://github.com/rails/rails/blob/master/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb
Although more advanced options control can be obtained by a 'hack' using concerns and including it directly into ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper
The README offers the following code snippet to integrate with activejob.
Sidekiq.default_worker_options = { unique: :until_executing, unique_args: ->(args) { [ args.first.except('job_id') ] } }
But does not state how to implement this code. A few questions I have:
The documentation is very bear bones and is not understandable as it is currently written. A brief explanation would do wonders for integrating this very helpful gem with activejob.
The text was updated successfully, but these errors were encountered: