Module: DTR::Adapter::Follower
- Included in:
- DTR::Agent::Brain, Monitor::MasterMonitor
- Defined in:
- lib/dtr/shared/adapter/base.rb,
lib/dtr/shared/adapter/mortality.rb
Instance Method Summary collapse
Instance Method Details
#relax ⇒ Object
48 49 50 51 52 |
# File 'lib/dtr/shared/adapter/base.rb', line 48 def relax if defined?(@soc) && @soc @soc.close rescue nil end end |
#sleep? ⇒ Boolean
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dtr/shared/adapter/base.rb', line 37 def sleep? return true unless defined?(@wakeup_for_host) Timeout.timeout(DTR.configuration.follower_listen_heartbeat_timeout) do until (msg, host = listen) && host == @wakeup_for_host; end msg == Adapter::SLEEP_MESSAGE end rescue Timeout::Error => e DTR.info {"Timeout while listening command"} true end |
#wakeup? ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dtr/shared/adapter/base.rb', line 23 def wakeup? msg, host, group = listen if group == DTR.configuration.group && msg == Adapter::WAKEUP_MESSAGE ip, port = host.split(':') DTR.configuration.rinda_server_port = port.to_i DTR.configuration.broadcast_list = [ip] DTR.configuration.save DTR.info {"=> Rinda server port: #{DTR.configuration.rinda_server_port}"} DTR.info {"=> Broadcast list: #{DTR.configuration.broadcast_list.inspect}"} @wakeup_for_host = host true end end |