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

Allow the use of DNS discovery for eureka connections #5

Merged
merged 9 commits into from
Jun 19, 2014
Merged

Conversation

ryansb
Copy link
Contributor

@ryansb ryansb commented Jun 17, 2014

No description provided.

@ryansb ryansb closed this Jun 19, 2014
@ryansb ryansb deleted the discoverDNS branch June 19, 2014 17:51
@ryansb ryansb reopened this Jun 19, 2014
@samography
Copy link

Looks good to 🚢

if e.DNSDiscovery && len(e.discoveryTtl) == 0 {
servers, ttl, err := discoverDNS(e.DiscoveryZone, e.ServicePort)
if err != nil {
return e.ServiceUrls[rand.Int()%len(e.ServiceUrls)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth pulling out the index part of this into a variable to just make it a little clearer what's going on.

if err != nil {
return e.ServiceUrls[rand.Int()%len(e.ServiceUrls)]
}
e.discoveryTtl <- struct{}{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a bit to figure out what was going on here, but the process seems good. You could probably extract the channel ops to clear it up if you wanted to (e.needsRefresh(), e.refreshDiscovery(), etc). I don't have suggestions for improving the logic, though.

ryansb added a commit that referenced this pull request Jun 19, 2014
Allow the use of DNS discovery for eureka connections
@ryansb ryansb merged commit 5f63bca into master Jun 19, 2014
log.Error("no answer for name=%s err=%s", fqdn, err.Error())
return nil, defaultTTL, err
}
if response.Answer[0].Header().Rrtype != dns.TypeTXT {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could pull out response.Answer[0] into a variable since you're using it in three places if you wanted.

@tysonstewart
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants