-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
resolver/dns: exponential retry when getting empty address list #2201
Conversation
resolver/dns/dns_resolver.go
Outdated
@@ -66,7 +67,7 @@ func NewBuilder() resolver.Builder { | |||
} | |||
|
|||
type dnsBuilder struct { | |||
// frequency of polling the DNS server. | |||
// minimum frequency of polling the DNS server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Maximum"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think frequency is minimum, interval is maximum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. The variable is not actually the frequency, it's the interval, hence my confusion.
I also think we should rename the variable to something to indicate it's a limit now, e.g. "maxDelay" or "minFreq".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to minFreq
resolver/dns/dns_resolver.go
Outdated
d.retryCount++ | ||
d.t.Reset(d.backoff.Backoff(d.retryCount)) | ||
} else { | ||
if d.retryCount != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "if" here is unnecessary and is worse for performance (CPUs hate conditional branches far more than stores).
fix #1795