Sha256: 4adcd28d855c230d9121aaafa5df224bd312e2e0ade16947106f8cf8afb8b994
Contents?: true
Size: 757 Bytes
Versions: 4
Compression:
Stored size: 757 Bytes
Contents
class Eye::Trigger::CheckDependency < Eye::Trigger param :names, [Array], true, 5 def check(transition) check_dependency(transition.to_name) if transition.from_name == :up end private def check_dependency(to) processes = names.map do |name| Eye::Control.find_nearest_process(name, process.group_name_pure, process.app_name) end.compact.select { |p| p.state_name != :unmonitored } return if processes.empty? processes = Eye::Utils::AliveArray.new(processes) act = case to when :down, :restarting; :restart when :stopping; :stop when :unmonitored; :unmonitor end if act processes.each do |p| p.schedule act, Eye::Reason.new(:"#{act} dependecies") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems