mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Fix SortedEntry#reschedule when called with non float as time (#4342)
This commit is contained in:
parent
9275dca070
commit
6a4fe1ab8d
2 changed files with 3 additions and 1 deletions
|
@ -467,7 +467,7 @@ module Sidekiq
|
|||
|
||||
def reschedule(at)
|
||||
Sidekiq.redis do |conn|
|
||||
conn.zincrby(@parent.name, at - @score, Sidekiq.dump_json(@item))
|
||||
conn.zincrby(@parent.name, at.to_f - @score, Sidekiq.dump_json(@item))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -613,11 +613,13 @@ describe 'API' do
|
|||
refute(retries.map { |r| r.score > (Time.now.to_f + 9) }.any?)
|
||||
|
||||
retries.each do |retri|
|
||||
retri.reschedule(Time.now + 15) if retri.jid == 'foo1'
|
||||
retri.reschedule(Time.now.to_f + 10) if retri.jid == 'foo2'
|
||||
end
|
||||
|
||||
assert_equal 2, retries.size
|
||||
assert(retries.map { |r| r.score > (Time.now.to_f + 9) }.any?)
|
||||
assert(retries.map { |r| r.score > (Time.now.to_f + 14) }.any?)
|
||||
end
|
||||
|
||||
it 'prunes processes which have died' do
|
||||
|
|
Loading…
Add table
Reference in a new issue