mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Handle case of no jobs to push_bulk, fixes #2997
This commit is contained in:
parent
de9347a172
commit
776e69d631
2 changed files with 5 additions and 0 deletions
|
@ -84,6 +84,7 @@ module Sidekiq
|
|||
# than the number given if the middleware stopped processing for one or more jobs.
|
||||
def push_bulk(items)
|
||||
arg = items['args'].first
|
||||
return [] unless arg # no jobs to push
|
||||
raise ArgumentError, "Bulk arguments must be an Array of Arrays: [[1], [2]]" if !arg.is_a?(Array)
|
||||
|
||||
normed = normalize_item(items)
|
||||
|
|
|
@ -126,6 +126,10 @@ class TestClient < Sidekiq::Test
|
|||
assert_match(/[0-9a-f]{12}/, jid)
|
||||
end
|
||||
end
|
||||
it 'handles no jobs' do
|
||||
result = Sidekiq::Client.push_bulk('class' => 'QueuedWorker', 'args' => [])
|
||||
assert_equal 0, result.size
|
||||
end
|
||||
end
|
||||
|
||||
class BaseWorker
|
||||
|
|
Loading…
Reference in a new issue