Skip to content

Commit

Permalink
fix the performance issue when calling getHostName (apolloconfig#2152)
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodyiam authored Apr 21, 2019
1 parent 1164038 commit ea60157
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ public InetAddress findValidateIp(List<InetAddress> addresses) {
weight += 2;
}

/**
* The following logic is removed as we will sort the network interfaces according to the index asc to determine
* the priorities between network interfaces, see https://github.com/ctripcorp/apollo/pull/1986
*/
// has host name
// TODO fix performance issue when calling getHostName
/*
if (!Objects.equals(address.getHostName(), address.getHostAddress())) {
weight += 1;
}
*/

if (weight > maxWeight) {
maxWeight = weight;
Expand Down

0 comments on commit ea60157

Please sign in to comment.