diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index 5445a8c3..8f4e77be 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -192,6 +192,10 @@ module Sidekiq opts[:require] = arg end + o.on '-i', '--index INT', "unique process index on this machine" do |arg| + opts[:index] = Integer(arg) + end + o.on '-c', '--concurrency INT', "processor threads to use" do |arg| opts[:concurrency] = Integer(arg) end diff --git a/test/test_cli.rb b/test/test_cli.rb index e4eaf9aa..1738be03 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -40,6 +40,11 @@ class TestCli < MiniTest::Unit::TestCase assert_equal ['foo'], Sidekiq.options[:queues] end + it 'accepts a process index' do + @cli.parse(['sidekiq', '-i', '7', '-r', './test/fake_env.rb']) + assert_equal 7, Sidekiq.options[:index] + end + it 'sets strictly ordered queues if weights are not present' do @cli.parse(['sidekiq', '-q', 'foo,bar', '-r', './test/fake_env.rb']) assert_equal true, !!Sidekiq.options[:strict]