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

Allow identifier with multiple workers #1190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Update command.rb
Allow identifier with multiple workers
  • Loading branch information
toncid committed Jun 5, 2023
commit 4628f6e71a231b9c517914b55b1f2a4a5768d4dd
12 changes: 3 additions & 9 deletions lib/delayed/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,11 @@ def daemonize # rubocop:disable PerceivedComplexity

if worker_pools
setup_pools
elsif @options[:identifier]
# rubocop:disable GuardClause
if worker_count > 1
raise ArgumentError, 'Cannot specify both --number-of-workers and --identifier'
else
run_process("delayed_job.#{@options[:identifier]}", @options)
end
# rubocop:enable GuardClause
else
worker_count.times do |worker_index|
process_name = worker_count == 1 ? 'delayed_job' : "delayed_job.#{worker_index}"
process_name = 'delayed_job'
process_name += ".#{@options[:identifier]}" if @options[:identifier]
process_name += ".#{worker_index}" if worker_count > 1
run_process(process_name, @options)
end
end
Expand Down