Skip to content

Commit

Permalink
Fixed naming for keys
Browse files Browse the repository at this point in the history
  • Loading branch information
cthulhu committed Jul 19, 2011
1 parent 609c653 commit 2c14db1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/resque/lock.rb
Expand Up @@ -8,12 +8,11 @@ module Lock
# normal lock
def lock_key( options = {} )
klass = options.delete("klass") || self.name
"lock:#{klass}-#{options.to_a.sort_by(&:first).map{|a| a.join("=") }.join("|")}"
"lock:#{klass}-#{options.to_a.sort{|a,b| a[0].to_s <=> b[0].to_s }.map{|a| a.join("=") }.join("|")}"
end

def competitive_lock_key( options = {} )
klass = options.delete("klass") || self.name
"competitive-lock:#{klass}-#{options.to_a.sort_by(&:first).map{|a| a.join("=") }.join("|")}"
"competitive-#{lock_key( options )}"
end

def locked?( options )
Expand Down

0 comments on commit 2c14db1

Please sign in to comment.