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

feat(net) : optimize the sortPeers method #5873

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

zeusoo001
Copy link
Contributor

What does this PR do?
Optimize the sortPeers method, refer to issue: #5849

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@lvs007 lvs007 linked an issue Jun 21, 2024 that may be closed by this pull request
@@ -94,7 +94,11 @@ private static void remove(PeerConnection peerConnection) {
}

public static synchronized void sortPeers() {
peers.sort(Comparator.comparingDouble(c -> c.getChannel().getAvgLatency()));
Copy link
Contributor

@317787106 317787106 Jul 1, 2024

Choose a reason for hiding this comment

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

Why not use Comparator.comparingLong ? the type of c.getChannel().getAvgLatency() is long

Copy link
Contributor Author

@zeusoo001 zeusoo001 Jul 1, 2024

Choose a reason for hiding this comment

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

get

@lvs007 lvs007 merged commit bcba5c1 into tronprotocol:develop Jul 1, 2024
7 checks passed
@zeusoo001 zeusoo001 deleted the sortpeers-method-opt branch August 13, 2024 06:33
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.

IllegalArgumentException appears in the log
5 participants