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

Standardize on concurrency, not processor_count

This commit is contained in:
jc00ke 2012-02-16 09:45:55 -08:00
parent 6f22320aee
commit ea8c9f72b5
5 changed files with 12 additions and 13 deletions

View file

@ -93,7 +93,7 @@ module Sidekiq
def parse_options(argv)
@options = {
:queues => [],
:processor_count => 25,
:concurrency => 25,
:require => '.',
:environment => nil,
}
@ -125,7 +125,7 @@ module Sidekiq
end
o.on '-c', '--concurrency INT', "processor threads to use" do |arg|
@options[:processor_count] = arg.to_i
@options[:concurrency] = arg.to_i
end
o.on '-P', '--pidfile PATH', "path to pidfile" do |arg|
@ -172,7 +172,10 @@ module Sidekiq
opts.each do |option, value|
@options[option.intern] ||= value
end
@options[:concurrency] = opts['processor_count'] if opts['processor_count']
concurrency = opts.delete('concurrency')
if @options[:concurrency] == 25 && concurrency
@options[:concurrency] = concurrency
end
set_logger_level_to_debug if @options[:verbose]
end
end

View file

@ -25,7 +25,7 @@ module Sidekiq
def initialize(options={})
logger.info "Booting sidekiq #{Sidekiq::VERSION} with Redis at #{redis.client.location}"
logger.debug { options.inspect }
@count = options[:processor_count] || 25
@count = options[:concurrency] || 25
@queues = options[:queues]
@done_callback = nil

View file

@ -5,7 +5,7 @@ server: 127.0.0.1:1234
environment: xzibit
require: ./test/fake_env.rb
pidfile: /tmp/sidekiq-config-test.pid
processor_count: 50
concurrency: 50
queues:
- [often, 2]
- [seldom, 1]

View file

@ -22,7 +22,7 @@ class TestCli < MiniTest::Unit::TestCase
it 'changes concurrency' do
@cli.parse(['sidekiq', '-c', '60', '-r', './test/fake_env.rb'])
assert_equal 60, @cli.options[:processor_count]
assert_equal 60, @cli.options[:concurrency]
end
it 'changes queues' do
@ -124,8 +124,8 @@ class TestCli < MiniTest::Unit::TestCase
File.unlink @tmp_path if File.exist? @tmp_path
end
it 'uses processor count flag' do
assert_equal 100, @cli.options[:processor_count]
it 'uses concurrency flag' do
assert_equal 100, @cli.options[:concurrency]
end
it 'uses namespace flag' do
@ -140,10 +140,6 @@ class TestCli < MiniTest::Unit::TestCase
assert_equal 'snoop', @cli.options[:environment]
end
it 'uses concurrency flag' do
assert_equal 100, @cli.options[:processor_count]
end
it 'uses pidfile flag' do
assert_equal @tmp_path, @cli.options[:pidfile]
end

View file

@ -30,7 +30,7 @@ class TestManager < MiniTest::Unit::TestCase
Sidekiq::Client.push(:foo, 'class' => IntegrationWorker, 'args' => [1, 3])
q = TimedQueue.new
mgr = Sidekiq::Manager.new(:queues => [:foo], :processor_count => 2)
mgr = Sidekiq::Manager.new(:queues => [:foo], :concurrency => 2)
mgr.when_done do |_|
q << 'done' if $processed == 2
end