dragosvictor commented on code in PR #21682:
URL: https://github.com/apache/pulsar/pull/21682#discussion_r1426246082


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -665,15 +672,9 @@ protected synchronized boolean 
trySendMessagesToConsumers(ReadType readType, Lis
         long totalEntries = 0;
         int avgBatchSizePerMsg = remainingMessages > 0 ? 
Math.max(remainingMessages / entries.size(), 1) : 1;
 
-        int firstAvailableConsumerPermits, currentTotalAvailablePermits;
-        boolean dispatchMessage;
-        while (entriesToDispatch > 0) {
-            firstAvailableConsumerPermits = getFirstAvailableConsumerPermits();
-            currentTotalAvailablePermits = Math.max(totalAvailablePermits, 
firstAvailableConsumerPermits);
-            dispatchMessage = currentTotalAvailablePermits > 0 && 
firstAvailableConsumerPermits > 0;

Review Comment:
   I'd argue that we can go even further and remove the permit check 
completely, since grabbing the next consumer in the following line does a very 
similar check, for the same computational complexity. I'd have to double-check 
that though, skipping for now.



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