congbobo184 commented on a change in pull request #11135: URL: https://github.com/apache/pulsar/pull/11135#discussion_r661257936
########## File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java ########## @@ -310,13 +311,15 @@ protected int calculateNumOfMessageToRead(int currentTotalAvailablePermits) { } topic.getBrokerService().executor().schedule(() -> readMoreEntries(), MESSAGE_RATE_BACKOFF_MS, TimeUnit.MILLISECONDS); - return -1; + return Pair.of(-1, -1L); } else { - // if dispatch-rate is in msg then read only msg according to available permit - long availablePermitsOnMsg = topicRateLimiter.getAvailableDispatchRateLimitOnMsg(); - if (availablePermitsOnMsg > 0) { - messagesToRead = Math.min(messagesToRead, (int) availablePermitsOnMsg); - } + Pair<Integer, Long> calculateResult = computeReadLimits(messagesToRead, + (int) topicRateLimiter.getAvailableDispatchRateLimitOnMsg(), + topicRateLimiter.getAvailableDispatchRateLimitOnByte(), bytesToRead); Review comment: done, could you please review again? if don't have any other comment, please approve this pr then we will merge 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org