mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
fix retry option on normalize
This commit is contained in:
parent
0e8b6fe65e
commit
44f02fbcfe
2 changed files with 8 additions and 1 deletions
|
@ -126,7 +126,7 @@ module Sidekiq
|
|||
|
||||
normalized_item = item['class'].get_sidekiq_options.merge(item.dup)
|
||||
normalized_item['class'] = normalized_item['class'].to_s
|
||||
normalized_item['retry'] = !!normalized_item['retry']
|
||||
normalized_item['retry'] = !!normalized_item['retry'] unless normalized_item['retry'].is_a?(Fixnum)
|
||||
normalized_item['jid'] = SecureRandom.hex(12)
|
||||
|
||||
normalized_item
|
||||
|
|
|
@ -116,6 +116,9 @@ class TestClient < MiniTest::Unit::TestCase
|
|||
class BWorker < BaseWorker
|
||||
sidekiq_options 'retry' => 'b'
|
||||
end
|
||||
class CWorker < BaseWorker
|
||||
sidekiq_options 'retry' => 2
|
||||
end
|
||||
|
||||
describe 'client middleware' do
|
||||
|
||||
|
@ -148,5 +151,9 @@ class TestClient < MiniTest::Unit::TestCase
|
|||
it 'defaults retry to true' do
|
||||
assert_equal true, Sidekiq::Client.normalize_item('class' => QueuedWorker, 'args' => [])['retry']
|
||||
end
|
||||
|
||||
it 'should not normalize numeric retry\'s' do
|
||||
assert_equal 2, Sidekiq::Client.normalize_item('class' => CWorker, 'args' => [])['retry']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue