1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Merge pull request #263 from statianzo/fix-zadd-return

Handle Redis#zadd return value correctly when Scheduling
This commit is contained in:
Mike Perham 2012-06-20 15:38:10 -07:00
commit 80c2e06bfe
2 changed files with 3 additions and 3 deletions

View file

@ -49,7 +49,7 @@ module Sidekiq
payload = Sidekiq.dump_json(item)
Sidekiq.redis do |conn|
if item['at']
pushed = (conn.zadd('schedule', item['at'].to_s, payload) == 1)
pushed = conn.zadd('schedule', item['at'].to_s, payload)
else
_, pushed = conn.multi do
conn.sadd('queues', queue)

View file

@ -18,13 +18,13 @@ class TestScheduling < MiniTest::Unit::TestCase
end
it 'schedules a job via interval' do
@redis.expect :zadd, 1, ['schedule', String, String]
@redis.expect :zadd, true, ['schedule', String, String]
assert_equal true, ScheduledWorker.perform_in(600, 'mike')
@redis.verify
end
it 'schedules a job via timestamp' do
@redis.expect :zadd, 1, ['schedule', String, String]
@redis.expect :zadd, true, ['schedule', String, String]
assert_equal true, ScheduledWorker.perform_in(5.days.from_now, 'mike')
@redis.verify
end