Skip to content

Commit

Permalink
allow the no_wait option to be passed through to daemons
Browse files Browse the repository at this point in the history
  • Loading branch information
rfroetscher committed May 16, 2016
1 parent 1e67917 commit bd2a9b6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/delayed/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def initialize(args) # rubocop:disable MethodLength
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
@options[:exit_on_complete] = true
end
opt.on('--no_wait', 'Do not force kill long running jobs') do
@no_wait = true
end
end
@args = opts.parse!(args)
end
Expand Down Expand Up @@ -115,7 +118,16 @@ def setup_pools

def run_process(process_name, options = {})
Delayed::Worker.before_fork
Daemons.run_proc(process_name, :dir => options[:pid_dir], :dir_mode => :normal, :monitor => @monitor, :ARGV => @args) do |*_args|

daemon_options = {
:dir => options[:pid_dir],
:dir_mode => :normal,
:monitor => @monitor,
:no_wait => @no_wait,
:ARGV => @args
}

Daemons.run_proc(process_name, daemon_options) do |*_args|
$0 = File.join(options[:prefix], process_name) if @options[:prefix]
run process_name, options
end
Expand Down

0 comments on commit bd2a9b6

Please sign in to comment.