Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent exit on ZK detection timeout #306

Merged
merged 1 commit into from
Oct 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,13 @@ func main() {

reload := time.NewTicker(time.Second * time.Duration(config.RefreshSeconds))

zkTimeout := time.Second * time.Duration(config.ZkDetectionTimeout)
timeout := time.AfterFunc(zkTimeout, func() {
errch <- fmt.Errorf("master detection timed out after %s", zkTimeout)
})

defer reload.Stop()
defer util.HandleCrash()
for {
select {
case <-reload.C:
res.Reload()
case masters := <-changed:
timeout.Stop()
logging.VeryVerbose.Printf("new masters detected: %v", masters)
res.SetMasters(masters)
res.Reload()
Expand Down
42 changes: 19 additions & 23 deletions records/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ type Config struct {
// Timeout is the default connect/read/write timeout for outbound
// queries
Timeout int
// Zookeeper Detection Timeout: how long in seconds to wait for Zookeeper to be initially responsive (default 30)
ZkDetectionTimeout int
// NOTE(tsenart): HTTPPort, DNSOn and HTTPOn have defined JSON keys for
// backwards compatibility with external API clients.
HTTPPort int `json:"HttpPort"`
Expand Down Expand Up @@ -66,26 +64,25 @@ type Config struct {
// NewConfig return the default config of the resolver
func NewConfig() Config {
return Config{
ZkDetectionTimeout: 30,
RefreshSeconds: 60,
TTL: 60,
Domain: "mesos",
Port: 53,
Timeout: 5,
SOARname: "root.ns1.mesos",
SOAMname: "ns1.mesos",
SOARefresh: 60,
SOARetry: 600,
SOAExpire: 86400,
SOAMinttl: 60,
Resolvers: []string{"8.8.8.8"},
Listener: "0.0.0.0",
HTTPPort: 8123,
DNSOn: true,
HTTPOn: true,
ExternalOn: true,
RecurseOn: true,
IPSources: []string{"netinfo", "mesos", "host"},
RefreshSeconds: 60,
TTL: 60,
Domain: "mesos",
Port: 53,
Timeout: 5,
SOARname: "root.ns1.mesos",
SOAMname: "ns1.mesos",
SOARefresh: 60,
SOARetry: 600,
SOAExpire: 86400,
SOAMinttl: 60,
Resolvers: []string{"8.8.8.8"},
Listener: "0.0.0.0",
HTTPPort: 8123,
DNSOn: true,
HTTPOn: true,
ExternalOn: true,
RecurseOn: true,
IPSources: []string{"netinfo", "mesos", "host"},
}
}

Expand Down Expand Up @@ -129,7 +126,6 @@ func SetConfig(cjson string) Config {
logging.Verbose.Println("Mesos-DNS configuration:")
logging.Verbose.Println(" - Masters: " + strings.Join(c.Masters, ", "))
logging.Verbose.Println(" - Zookeeper: ", c.Zk)
logging.Verbose.Println(" - ZookeeperDetectionTimeout: ", c.ZkDetectionTimeout)
logging.Verbose.Println(" - RefreshSeconds: ", c.RefreshSeconds)
logging.Verbose.Println(" - Domain: " + c.Domain)
logging.Verbose.Println(" - Listener: " + c.Listener)
Expand Down