Skip to content

Commit

Permalink
Generate lock_id from hash
Browse files Browse the repository at this point in the history
  • Loading branch information
take-five committed May 22, 2013
1 parent c9507c5 commit 414e467
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/resque/integration/unique.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

require 'digest/sha1'

require 'active_support/core_ext/module/aliasing'

require 'resque/plugins/lock'
Expand Down Expand Up @@ -52,7 +54,7 @@ def lock_on(&block)
# LockID should be independent from MetaID
# @api private
def lock(meta_id, *args)
"lock:#{name}-#{lock_on[*args].to_s}"
"lock:#{name}-#{Digest::SHA1.hexdigest(lock_on[*args].to_s)}"
end

# Overriding +meta_id+ here so now it generates the same MetaID for Jobs with same args
Expand Down

0 comments on commit 414e467

Please sign in to comment.