Refactor #stop to reference ALL_PROCESSES for a bit clearer readability
This commit is contained in:
@@ -63,7 +63,7 @@ class Foreman::Engine
|
|||||||
|
|
||||||
def stop(name, signal='SIGTERM')
|
def stop(name, signal='SIGTERM')
|
||||||
running_processes.each do |pid, process|
|
running_processes.each do |pid, process|
|
||||||
unless name.nil?
|
unless name == ALL_PROCESSES
|
||||||
# Comparing against process.entry.name instead of process.name to
|
# Comparing against process.entry.name instead of process.name to
|
||||||
# make sure we match the process name exactly for any/all
|
# make sure we match the process name exactly for any/all
|
||||||
# concurrently running processes by this name
|
# concurrently running processes by this name
|
||||||
@@ -104,10 +104,10 @@ private ######################################################################
|
|||||||
return if @terminating
|
return if @terminating
|
||||||
@terminating = true
|
@terminating = true
|
||||||
Timeout.timeout(5) do
|
Timeout.timeout(5) do
|
||||||
stop(nil)
|
stop ALL_PROCESSES
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
stop(nil, 'SIGKILL')
|
stop(ALL_PROCESSES, 'SIGKILL')
|
||||||
rescue Errno::ECHILD
|
rescue Errno::ECHILD
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user