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

Calculate worker's unique args when a proc or a symbol is specified #143

Merged
merged 2 commits into from Oct 31, 2015

Conversation

zeqfreed
Copy link
Contributor

Hi!

There was a bug which made it so job's unique digest was calculated incorrectly when worker's unique_args option was specified. If unique_args was any thuthy value (e.g. a proc or a symbol), then at line 23 in file lib/sidekiq_unique_jobs/unique_args.rb nothing happened and unique_args calculation actually never took place.

I fixed this line and modified specs to test unique_digest generation for different cases of worker options.
Also I had to fix two existing test worker classes, because they were written with assumption that arguments are passed separately, but in fact in current implementation unique_args method or proc receive arguments as a single array, which by the way contradicts some examples in README file.

This PR should fix #138.

@@ -1,7 +1,7 @@
class CustomQueueJobWithFilterMethod < CustomQueueJob
sidekiq_options unique: :until_executed, unique_args: :args_filter

def self.args_filter(*args)
def self.args_filter(args)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I obviously forgot to remove splatting of arguments in a few places!

@mhenrixon mhenrixon merged commit 8bc9e99 into mhenrixon:master Oct 31, 2015
@mhenrixon
Copy link
Owner

Thank you for the contribution, was a great find!

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

Successfully merging this pull request may close these issues.

Jobs not getting queued in v4
2 participants