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

push_batch => push_bulk

This commit is contained in:
Mike Perham 2012-09-13 17:38:56 -07:00
parent b65a067ce8
commit c4fc7fd806
3 changed files with 6 additions and 6 deletions

View file

@ -1,10 +1,10 @@
2.3.1
-----------
- Add Sidekiq::Client.push\_batch for bulk adding of jobs to Redis.
- Add Sidekiq::Client.push\_bulk for bulk adding of jobs to Redis.
My own simple test case shows pushing 10,000 jobs goes from 5 sec to 1.5 sec.
- Re-enable Celluloid::Actor#defer to fix stack overflow issues [#398]
- Add support for multiple processes per host to Capistrano recipe
- Re-enable Celluloid::Actor#defer to fix stack overflow issues [#398]
2.3.0
-----------

View file

@ -66,7 +66,7 @@ module Sidekiq
# Returns the number of jobs pushed or nil if the pushed failed. The number of jobs
# pushed can be less than the number given if the middleware stopped processing for one
# or more jobs.
def self.push_batch(items)
def self.push_bulk(items)
normed = normalize_item(items)
payloads = items['args'].map do |args|
_, payload = process_single(items['class'], normed.merge('args' => args, 'jid' => SecureRandom.hex(12)))

View file

@ -99,10 +99,10 @@ class TestClient < MiniTest::Unit::TestCase
end
end
describe 'batch' do
describe 'bulk' do
it 'can push a large set of jobs at once' do
a = Time.now
count = Sidekiq::Client.push_batch('class' => QueuedWorker, 'args' => (1..1_000).to_a.map { |x| Array(x) })
count = Sidekiq::Client.push_bulk('class' => QueuedWorker, 'args' => (1..1_000).to_a.map { |x| Array(x) })
assert_equal 1_000, count
end
end
@ -130,7 +130,7 @@ class TestClient < MiniTest::Unit::TestCase
begin
assert_equal nil, Sidekiq::Client.push('class' => MyWorker, 'args' => [0])
assert_match /[0-9a-f]{12}/, Sidekiq::Client.push('class' => MyWorker, 'args' => [1])
assert_equal 1, Sidekiq::Client.push_batch('class' => MyWorker, 'args' => [[0], [1]])
assert_equal 1, Sidekiq::Client.push_bulk('class' => MyWorker, 'args' => [[0], [1]])
ensure
Sidekiq.client_middleware.remove Stopper
end