Module: Eye::Process::Watchers
- Included in:
- ChildProcess, Eye::Process
- Defined in:
- lib/eye/process/watchers.rb
Instance Method Summary collapse
Instance Method Details
#add_watchers(force = false) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/eye/process/watchers.rb', line 3 def add_watchers(force = false) return unless self.up? remove_watchers if force if @watchers.blank? # default watcher :check_alive add_watcher(:check_alive, self[:check_alive_period]) do check_alive end # monitor children pids if self[:monitor_children] add_watcher(:check_children, self[:children_update_period]) do add_or_update_children end end # monitor conditional watchers start_checkers else warn 'add_watchers failed, watchers are already present' end end |
#remove_watchers ⇒ Object
28 29 30 31 |
# File 'lib/eye/process/watchers.rb', line 28 def remove_watchers @watchers.each{|_, h| h[:timer].cancel } @watchers = {} end |