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

deduplicate dns record in lookup #1454

Merged
merged 3 commits into from
Aug 23, 2017
Merged

deduplicate dns record in lookup #1454

merged 3 commits into from
Aug 23, 2017

Conversation

lyuxuan
Copy link
Contributor

@lyuxuan lyuxuan commented Aug 22, 2017

No description provided.

}
return res

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

delete(update, *u)
continue
func (w *dnsWatcher) compileUpdate(newAddrs map[string]*Update) []*Update {
res := make([]*Update, 0, len(newAddrs)+len(w.curAddrs))
Copy link
Contributor

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -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)),
Copy link
Contributor

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))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -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}
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@menghanl menghanl left a comment

Choose a reason for hiding this comment

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

LGTM.

@lyuxuan lyuxuan merged commit 9b6ac7d into grpc:master Aug 23, 2017
@dfawley dfawley modified the milestone: 1.6 Release Aug 28, 2017
menghanl pushed a commit to menghanl/grpc-go that referenced this pull request Aug 30, 2017
deduplicate dns record in lookup
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants