lib/einhorn/command.rb in einhorn-0.6.3 vs lib/einhorn/command.rb in einhorn-0.6.4
- old
+ new
@@ -121,9 +121,24 @@
else
signaled << child
end
end
+ if Einhorn::State.signal_timeout
+ Einhorn::Event::Timer.open(Einhorn::State.signal_timeout) do
+ children.each do |child|
+ next unless spec = Einhorn::State.children[child]
+
+ Einhorn.log_info("Child #{child.inspect} is still active after #{Einhorn::State.signal_timeout}. Sending SIGKILL.")
+ begin
+ Process.kill('KILL', child)
+ rescue Errno::ESRCH
+ end
+ spec[:signaled].add('KILL')
+ end
+ end
+ end
+
"Successfully sent #{signal}s to #{signaled.length} processes: #{signaled.inspect}"
end
def self.increment
Einhorn::Event.break_loop