-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
deduplicate dns record in lookup #1454
Conversation
naming/dns_resolver.go
Outdated
} | ||
return res | ||
|
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.
Remove this empty line
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.
done
naming/dns_resolver.go
Outdated
delete(update, *u) | ||
continue | ||
func (w *dnsWatcher) compileUpdate(newAddrs map[string]*Update) []*Update { | ||
res := make([]*Update, 0, len(newAddrs)+len(w.curAddrs)) |
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.
How about just var res []*Update
?
Length of updates may be much shorter than len(newAddrs)+len(w.curAddrs)
.
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.
done
naming/dns_resolver.go
Outdated
@@ -231,15 +228,15 @@ func (w *dnsWatcher) lookupSRV() []*Update { | |||
grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) | |||
continue | |||
} | |||
newAddrs = append(newAddrs, &Update{Addr: a + ":" + strconv.Itoa(int(s.Port)), | |||
Metadata: AddrMetadataGRPCLB{AddrType: GRPCLB, ServerName: s.Target}}) | |||
newAddrs[a+":"+strconv.Itoa(int(s.Port))] = &Update{Addr: a + ":" + strconv.Itoa(int(s.Port)), |
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.
Add a local variable for a+":"+strconv.Itoa(int(s.Port))
?
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.
done
naming/dns_resolver.go
Outdated
@@ -251,7 +248,7 @@ func (w *dnsWatcher) lookupHost() []*Update { | |||
grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) | |||
continue | |||
} | |||
newAddrs = append(newAddrs, &Update{Addr: a + ":" + w.port}) | |||
newAddrs[a+":"+w.port] = &Update{Addr: a + ":" + w.port} |
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.
Local variable for a+":"+w.port
?
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.
done
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.
LGTM.
deduplicate dns record in lookup
No description provided.