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
class CustomWorker
include Sidekiq::Worker
sidekiq_options unique: :until_executed
unique_args: :custom_args
def self.custom_args
puts 'testing'
end
def perform(optional=nil)
end
end
running CustomWorker.perform_async will not run custom_args method and will not print 'testing'
But running CustomWorker.perform_async(nil), CustomWorker.perform_async(2) works as expected.
Always declare your unique_args method with parameters. Then you can decide what to do with the parameters should they be provided. I see the same result in my tests for all of the above. Now there should also be a helpful error message logged.
consider the following worker:
running
CustomWorker.perform_async
will not runcustom_args
method and will not print 'testing'But running
CustomWorker.perform_async(nil)
,CustomWorker.perform_async(2)
works as expected.ruby 2.1.8
gem 'sidekiq', '3.5.4'
gem 'sidekiq-cron', '0.3.1'
gem 'sidekiq-failures', '0.4.5'
gem 'sidekiq-unique-jobs', '4.0.18'
gem 'sidekiq_status', git: 'https://github.com/cryo28/sidekiq_status' (1.2.0)
The text was updated successfully, but these errors were encountered: