Module: DTR::Adapter::Master
- Included in:
- Master, Monitor::AgentsMonitor
- Defined in:
- lib/dtr/shared/adapter.rb
Instance Method Summary collapse
Instance Method Details
#do_wakeup_agents ⇒ Object
89 90 91 |
# File 'lib/dtr/shared/adapter.rb', line 89 def do_wakeup_agents yell_agents("#{Adapter::WAKEUP_MESSAGE} #{DTR.configuration.rinda_server_port} #{DTR.configuration.group}") end |
#hypnotize_agents ⇒ Object
69 70 71 |
# File 'lib/dtr/shared/adapter.rb', line 69 def hypnotize_agents yell_agents("#{Adapter::SLEEP_MESSAGE} #{DTR.configuration.rinda_server_port}") end |
#with_wakeup_agents(&block) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/dtr/shared/adapter.rb', line 73 def with_wakeup_agents(&block) heartbeat = Thread.new do loop do do_wakeup_agents sleep(DTR.configuration.master_heartbeat_interval) end end #heartbeat thread should have high priority for agent is listening heartbeat.priority = Thread.current.priority + 10 block.call ensure #kill heartbeat first, so that agents wouldn't be wakeup after hypnotized Thread.kill heartbeat rescue nil hypnotize_agents rescue nil end |