Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/resque/plugins/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def lock_timeout
# passed the same arguments as `perform`, that is, your job's
# payload.
def lock(*args)
"lock:#{name}-#{args.to_s}"
"lock:#{name}-#{Resque.encode(args)}"
end

# See the documentation for SETNX http://redis.io/commands/setnx for an
Expand Down
8 changes: 8 additions & 0 deletions test/lock_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def test_lock
assert_equal 1, Resque.redis.llen('queue:lock_test')
end

def test_lock_arguments
client_arguments = :test
client_lock = Job.lock(client_arguments)
job_arguments = Resque.decode(Resque.encode(client_arguments))
job_lock = Job.lock(job_arguments)
assert_equal client_lock, job_lock
end

def test_deadlock
now = Time.now.to_i

Expand Down