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

Remove support for -q foo,bar and -q foo,3,bar syntax. Use -q foo -q bar and -q foo,3 -q bar instead.

This commit is contained in:
Douwe Maan 2013-12-25 13:30:20 +01:00
parent 7747467cd4
commit 040eda558b
2 changed files with 6 additions and 21 deletions

View file

@ -258,9 +258,9 @@ module Sidekiq
opts[:profile] = arg
end
o.on "-q", "--queue QUEUE[,WEIGHT]...", "Queues to process with optional weights" do |arg|
queues_and_weights = arg.scan(/([\w\.-]+),?(\d*)/)
parse_queues opts, queues_and_weights
o.on "-q", "--queue QUEUE[,WEIGHT]", "Queues to process with optional weights" do |arg|
queue, weight = arg.split(",")
parse_queue opts, queue, weight
end
o.on '-r', '--require [PATH|DIR]', "Location of Rails application with workers or file to require" do |arg|
@ -336,7 +336,7 @@ module Sidekiq
end
def parse_queues(opts, queues_and_weights)
queues_and_weights.each {|queue_and_weight| parse_queue(opts, *queue_and_weight)}
queues_and_weights.each { |queue_and_weight| parse_queue(opts, *queue_and_weight) }
end
def parse_queue(opts, q, weight=nil)

View file

@ -51,11 +51,6 @@ class TestCli < Sidekiq::Test
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]
end
it 'sets strictly ordered queues if weights are not present multiple queue options' do
@cli.parse(['sidekiq', '-q', 'foo', '-q', 'bar', '-r', './test/fake_env.rb'])
assert_equal true, !!Sidekiq.options[:strict]
end
@ -66,11 +61,6 @@ class TestCli < Sidekiq::Test
end
it 'does not set strictly ordered queues if weights are present with multiple queues' do
@cli.parse(['sidekiq', '-q', 'foo,3,bar', '-r', './test/fake_env.rb'])
assert_equal false, !!Sidekiq.options[:strict]
end
it 'does not set strictly ordered queues if weights are present with multiple queue options' do
@cli.parse(['sidekiq', '-q', 'foo,3', '-q', 'bar', '-r', './test/fake_env.rb'])
assert_equal false, !!Sidekiq.options[:strict]
end
@ -80,18 +70,13 @@ class TestCli < Sidekiq::Test
assert_equal 30, Sidekiq.options[:timeout]
end
it 'handles multiple queues with weights with multiple switches' do
it 'handles multiple queues with weights' do
@cli.parse(['sidekiq', '-q', 'foo,3', '-q', 'bar', '-r', './test/fake_env.rb'])
assert_equal %w(foo foo foo bar), Sidekiq.options[:queues]
end
it 'handles multiple queues with weights with a single switch' do
@cli.parse(['sidekiq', '-q', 'bar,foo,3', '-r', './test/fake_env.rb'])
assert_equal %w(bar foo foo foo), Sidekiq.options[:queues]
end
it 'handles queues with multi-word names' do
@cli.parse(['sidekiq', '-q', 'queue_one,queue-two', '-r', './test/fake_env.rb'])
@cli.parse(['sidekiq', '-q', 'queue_one', '-q', 'queue-two', '-r', './test/fake_env.rb'])
assert_equal %w(queue_one queue-two), Sidekiq.options[:queues]
end