Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display warning if both pool and identifier flags are specified #1104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/delayed/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def initialize(args) # rubocop:disable MethodLength
@options[:queues] = queue.split(',')
end
opt.on('--pool=queue1[,queue2][:worker_count]', 'Specify queues and number of workers for a worker pool') do |pool|
warn '--identifier is ignored because --pool is specified and used.' if @options[:identifier]
parse_worker_pool(pool)
end
opt.on('--exit-on-complete', 'Exit when no more jobs are available to run. This will exit if all jobs are scheduled to run in the future.') do
Expand Down
12 changes: 12 additions & 0 deletions spec/delayed/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,16 @@
command.daemonize
end
end

describe 'when both --pool and --identifier are specified' do
it 'should ignore --identifier and display warning' do
command = nil
expect { command = Delayed::Command.new(['--identifier=42', '--pool=mailers']) }
.to output(/--identifier is ignored/).to_stderr

expect(command.worker_pools).to eq [
[['mailers'], 1],
]
end
end
end