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

Uniqueness across workers #210

Closed
mensfeld opened this issue Feb 18, 2017 · 5 comments
Closed

Uniqueness across workers #210

mensfeld opened this issue Feb 18, 2017 · 5 comments

Comments

@mensfeld
Copy link

Is there an option to realize uniquness across workers without hacking the digestable_hash method? I know there's an option to ensure uniqueness across queues but what about workers?

@mensfeld
Copy link
Author

mensfeld commented Feb 18, 2017

quick hack to fix that issue:

module SidekiqUniqueJobs
  class UniqueArgs
    def digestable_hash
      hash = @item.slice(CLASS_KEY, QUEUE_KEY, UNIQUE_ARGS_KEY)
      hash.delete(QUEUE_KEY) if unique_on_all_queues?
      hash.delete(CLASS_KEY) # this line makes difference
      hash
    end
  end
end

@mhenrixon
Copy link
Owner

Never thought of that. What is the use case more specifically?

@mensfeld
Copy link
Author

mensfeld commented Apr 9, 2017

@mhenrixon I have a bunch of workers (different) that operate on the same resource and I would love to be able to ensure that only one is working on it at the same time. Situation in rare but can happen.

@mhenrixon
Copy link
Owner

Closed by aabcd28

@mensfeld
Copy link
Author

@mhenrixon thank you. You've made my day with that one!

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