mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: handle termination cleanly in autospec
This commit is contained in:
@@ -61,11 +61,14 @@ class Demon::Base
|
||||
end
|
||||
end
|
||||
|
||||
def stop_signal
|
||||
"HUP"
|
||||
end
|
||||
|
||||
def stop
|
||||
@started = false
|
||||
if @pid
|
||||
# TODO configurable stop signal
|
||||
Process.kill("HUP", @pid)
|
||||
Process.kill(stop_signal, @pid)
|
||||
|
||||
wait_for_stop = lambda {
|
||||
timeout = @stop_timeout
|
||||
@@ -82,7 +85,7 @@ class Demon::Base
|
||||
wait_for_stop.call
|
||||
|
||||
if alive?
|
||||
STDERR.puts "Process would not terminate cleanly, force quitting. pid: #{@pid}"
|
||||
STDERR.puts "Process would not terminate cleanly, force quitting. pid: #{@pid} #{self.class}"
|
||||
Process.kill("KILL", @pid)
|
||||
end
|
||||
|
||||
|
@@ -6,6 +6,10 @@ class Demon::RailsAutospec < Demon::Base
|
||||
"rails-autospec"
|
||||
end
|
||||
|
||||
def stop_signal
|
||||
"TERM"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_fork
|
||||
|
Reference in New Issue
Block a user