lib/bluepill/process.rb in bluepill-0.1.1 vs lib/bluepill/process.rb in bluepill-0.1.2
- old
+ new
@@ -329,11 +329,11 @@
unless result[:exit_code].zero?
logger.warning 'Stop command execution returned non-zero exit code:'
logger.warning result.inspect
end
end
-
+ cleanup_process
elsif stop_signals
# issue stop signals with configurable delay between each
logger.warning "Sending stop signals to #{actual_pid}"
@threads << Thread.new(self, stop_signals.clone) do |process, stop_signals|
signal = stop_signals.shift
@@ -353,17 +353,17 @@
break
end
logger.info "Sending signal #{signal} to #{process.actual_pid}"
process.signal_process(signal)
end
+ cleanup_process
end
else
logger.warning "Executing default stop command. Sending TERM signal to #{actual_pid}"
signal_process('TERM')
+ cleanup_process
end
- ProcessJournal.kill_all_from_journal(name) # finish cleanup
- unlink_pid # TODO: we only write the pid file if we daemonize, should we only unlink it if we daemonize?
skip_ticks_for(stop_grace_time)
end
def restart_process
@@ -385,9 +385,14 @@
else
logger.warning 'No restart_command specified. Must stop and start to restart'
stop_process
start_process
end
+ end
+
+ def cleanup_process
+ ProcessJournal.kill_all_from_journal(name) # finish cleanup
+ unlink_pid # TODO: we only write the pid file if we daemonize, should we only unlink it if we daemonize?
end
def clean_threads
@threads.each(&:kill)
@threads.clear