From ec463a34ea0d3c8d3e249cffa8df09a8fc1a75b3 Mon Sep 17 00:00:00 2001 From: Oleh Khomey Date: Wed, 17 Dec 2014 15:05:55 +0200 Subject: [PATCH] Add no_wait and rename process on TERM --- lib/delayed/command.rb | 2 +- lib/delayed/worker.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/delayed/command.rb b/lib/delayed/command.rb index 52173f47b..5ff62dd95 100644 --- a/lib/delayed/command.rb +++ b/lib/delayed/command.rb @@ -120,7 +120,7 @@ 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, :no_wait => true, :monitor => @monitor, :ARGV => @args) do |*_args| + Daemons.run_proc(process_name, :log_output => true, :dir => options[:pid_dir], :dir_mode => :normal, :no_wait => true, :monitor => @monitor, :ARGV => @args) do |*_args| $0 = File.join(options[:prefix], process_name) if @options[:prefix] run process_name, options end diff --git a/lib/delayed/worker.rb b/lib/delayed/worker.rb index 1a352f775..cb13e0a11 100644 --- a/lib/delayed/worker.rb +++ b/lib/delayed/worker.rb @@ -155,6 +155,7 @@ def name def start # rubocop:disable CyclomaticComplexity, PerceivedComplexity trap('TERM') do + $0 += " (dead since #{Time.now.to_i})" Thread.new { say 'Exiting...' } stop raise SignalException, 'TERM' if self.class.raise_signal_exceptions