mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Fix retry default
This commit is contained in:
parent
c6cb222e96
commit
895a436b5a
2 changed files with 7 additions and 2 deletions
|
@ -118,12 +118,12 @@ module Sidekiq
|
|||
raise(ArgumentError, "Message must include a class and set of arguments: #{item.inspect}") if !item['class'] || !item['args']
|
||||
raise(ArgumentError, "Message must include a Sidekiq::Worker class, not class name: #{item['class'].ancestors.inspect}") if !item['class'].is_a?(Class) || !item['class'].respond_to?('get_sidekiq_options')
|
||||
|
||||
normalized_item = item.dup
|
||||
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['jid'] = SecureRandom.hex(12)
|
||||
|
||||
item['class'].get_sidekiq_options.merge normalized_item
|
||||
normalized_item
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -144,4 +144,9 @@ class TestClient < MiniTest::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
describe 'item normalization' do
|
||||
it 'defaults retry to true' do
|
||||
assert_equal true, Sidekiq::Client.normalize_item('class' => QueuedWorker, 'args' => [])['retry']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue