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 = if strategy == :kill_old pids[0...-below] else pids[below..-1] end 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 30 def kill_pids(pids) info "killing pids: #{pids.inspect} for strategy: #{strategy}" pids.each do |pid| if child = process.children[pid] child.schedule :stop, Eye::Reason.new("bounded #{check_name}") end end end
ordered_by_date_children_pids()
click to toggle source
# File lib/eye/checker/children_count.rb, line 39 def ordered_by_date_children_pids children = process.children.values children.sort_by { |ch| Eye::SystemResources.start_time(ch.pid).to_i }.map &:pid end