Class: Synapse::DnsWatcher

Inherits:
BaseWatcher show all
Defined in:
lib/synapse/service_watcher/dns.rb

Direct Known Subclasses

ZookeeperDnsWatcher::Dns

Constant Summary

Constants inherited from BaseWatcher

BaseWatcher::LEADER_WARN_INTERVAL

Instance Attribute Summary

Attributes inherited from BaseWatcher

#haproxy, #name

Instance Method Summary collapse

Methods inherited from BaseWatcher

#backends, #initialize, #stop

Methods included from Logging

configure_logger_for, #log, logger_for

Constructor Details

This class inherits a constructor from Synapse::BaseWatcher

Instance Method Details

#discovery_serversObject


21
22
23
# File 'lib/synapse/service_watcher/dns.rb', line 21

def discovery_servers
  @discovery['servers']
end

#ping?Boolean

Returns:

  • (Boolean)

17
18
19
# File 'lib/synapse/service_watcher/dns.rb', line 17

def ping?
  @watcher.alive? && !(resolver.getaddresses('airbnb.com').empty?)
end

#startObject


8
9
10
11
12
13
14
15
# File 'lib/synapse/service_watcher/dns.rb', line 8

def start
  @check_interval = @discovery['check_interval'] || 30.0
  @nameserver = @discovery['nameserver']

  @watcher = Thread.new do
    watch
  end
end