kaijchen commented on code in PR #817:
URL: https://github.com/apache/ratis/pull/817#discussion_r1093288332


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ReadIndexHeartbeats.java:
##########
@@ -110,6 +111,10 @@ boolean receive(LogAppender logAppender, 
AppendEntriesReplyProto proto,
       return isCompletedNormally();
     }
 
+    boolean isAcknowledged(RaftPeerId id) {
+      return 
Optional.ofNullable(replies.get(id)).map(HeartbeatAck::isAcknowledged).isPresent();

Review Comment:
   What if `replies.get(id)` is not null, but `HeartbeatAck::isAcknowledged` 
returns false?
   
   ```java
         return 
Optional.ofNullable(replies.get(id)).map(HeartbeatAck::isAcknowledged).getOrElse(false);
   ```
   ```java
         return 
Optional.ofNullable(replies.get(id)).filter(HeartbeatAck::isAcknowledged).isPresent();
   ```



-- 
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]

Reply via email to