class Eye::Checker::ChildrenCount
Public Instance Methods
fire()
click to toggle source
Calls superclass method
Eye::Checker#fire
# File lib/eye/checker/children_count.rb, line 12 def fire if strategy == :restart super else pids = ordered_by_date_children_pids pids = strategy == :kill_old ? pids[0...-below] : pids[below..-1] kill_pids(pids) end end
get_value()
click to toggle source
# File lib/eye/checker/children_count.rb, line 8 def get_value process.children.size end
Private Instance Methods
kill_pids(pids)
click to toggle source
# File lib/eye/checker/children_count.rb, line 24 def kill_pids(pids) info "killing pids: #{pids.inspect} for strategy: #{strategy}" pids.each do |pid| if child = process.children[pid] child.schedule command: :stop, reason: "bounded #{check_name}" end end end
ordered_by_date_children_pids()
click to toggle source
# File lib/eye/checker/children_count.rb, line 33 def ordered_by_date_children_pids children = process.children.values children.sort_by { |ch| [Eye::SystemResources.start_time(ch.pid).to_i, ch.pid] }.map(&:pid) end