szetszwo commented on code in PR #872:
URL: https://github.com/apache/ratis/pull/872#discussion_r1165664971


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -177,7 +177,7 @@ public long getWaitTimeMs() {
       // For normal nodes, new entries should be sent ASAP
       // however for slow followers (especially when the follower is down),
       // keep sending without any wait time only ends up in high CPU load
-      return Math.max(getMinWaitTimeMs(), 0L);
+      return Math.max(getTimeToWaitUntilNextSend(), 0L);
     }
     return Math.min(getMinWaitTimeMs(), getHeartbeatWaitTimeMs());

Review Comment:
   @adoroszlai , thanks a lot for working on this!
   
   Since `appendLog(..)` already takes care the min wait time, how about we 
simply return `getHeartbeatWaitTimeMs()` and keep other code unchanged?
   ```java
   +++ 
b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
   @@ -179,7 +179,7 @@ public class GrpcLogAppender extends LogAppenderBase {
          // keep sending without any wait time only ends up in high CPU load
          return Math.max(getMinWaitTimeMs(), 0L);
        }
   -    return Math.min(getMinWaitTimeMs(), getHeartbeatWaitTimeMs());
   +    return getHeartbeatWaitTimeMs();
      }
    
      private boolean isSlowFollower() {
   ```



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