From 4628f6e71a231b9c517914b55b1f2a4a5768d4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ton=C4=8Di=20Damjani=C4=87?= Date: Mon, 5 Jun 2023 10:20:10 +0200 Subject: [PATCH 1/2] Update command.rb Allow identifier with multiple workers --- lib/delayed/command.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/delayed/command.rb b/lib/delayed/command.rb index 281078242..47ac03084 100644 --- a/lib/delayed/command.rb +++ b/lib/delayed/command.rb @@ -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 From a2986479d30bfb10ec198066b1c197e347330d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ton=C4=8Di=20Damjani=C4=87?= Date: Mon, 5 Jun 2023 11:56:50 +0200 Subject: [PATCH 2/2] fix lint error --- lib/delayed/command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/delayed/command.rb b/lib/delayed/command.rb index 47ac03084..5f827d6f2 100644 --- a/lib/delayed/command.rb +++ b/lib/delayed/command.rb @@ -84,7 +84,7 @@ def initialize(args) # rubocop:disable MethodLength @args = opts.parse!(args) + (@daemon_options || []) end - def daemonize # rubocop:disable PerceivedComplexity + def daemonize dir = @options[:pid_dir] FileUtils.mkdir_p(dir) unless File.exist?(dir)