SammyVimes commented on code in PR #1579:
URL: https://github.com/apache/ignite-3/pull/1579#discussion_r1087559142
##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/RaftGroupServiceImpl.java:
##########
@@ -679,6 +694,14 @@ private Peer randomNode(@Nullable Peer excludedPeer) {
int lastPeerIndex = excludedPeer == null ? -1 :
peers0.indexOf(excludedPeer);
+ if (peers0.size() == 1) {
+ if (lastPeerIndex != -1) {
Review Comment:
Well it is kind of a Fast Path, as we already have `indexOf`, so we don't
need to call method, right? But yes, it looks too bizarre, I removed it
##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/RaftGroupServiceImpl.java:
##########
@@ -679,6 +694,14 @@ private Peer randomNode(@Nullable Peer excludedPeer) {
int lastPeerIndex = excludedPeer == null ? -1 :
peers0.indexOf(excludedPeer);
+ if (peers0.size() == 1) {
+ if (lastPeerIndex != -1) {
Review Comment:
Well it is kind of a Fast Path, as we already have `indexOf`, so we don't
need to call `get` method, right? But yes, it looks too bizarre, I removed it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]