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

Prevent Jobs from deleting mutexes they don't own #96

Merged
merged 1 commit into from
Jul 30, 2015

Conversation

pik
Copy link
Contributor

@pik pik commented Jul 27, 2015

Hello - so this should solve #94. The jid should already be sufficiently unique for each job and both server and client middleware have access to this.

Using the LUA script would be preferable since it saves a back-and-forth trip to the server, but if there users of sidekiq-unique-jobs with old versions of redis -- perhaps it would make sense to use the conn.watch version by default. (It's included for the tests anyways since mock-redis does not support lua scripts).

 * uses jid for redis mutex to prevent deletion of a mutex owned
   by another job after key expire.
@@ -0,0 +1,23 @@
require 'pry-byebug'
Copy link
Owner

Choose a reason for hiding this comment

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

Please remove this :)

require 'pry-byebug'
module SidekiqUniqueServerLib
def remove_if_matches
<<-LUA
Copy link
Owner

Choose a reason for hiding this comment

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

Great idea using LUA for this!

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.

None yet

2 participants