Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when arguments are empty then unique_args proc/method is not executed #201

Closed
salmanasiddiqui opened this issue Nov 18, 2016 · 2 comments
Closed

Comments

@salmanasiddiqui
Copy link

consider the following worker:

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.

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)

@mhenrixon
Copy link
Owner

Interesting, so no arguments passed seems to skip the custom_args method. Thanks for reporting.

@mhenrixon
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants