dragosvictor commented on code in PR #21682:
URL: https://github.com/apache/pulsar/pull/21682#discussion_r1424377494
##########
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:
Did not remove it, just fast-tracked it into the loop condition.
We fetch both `firstAvailableConsumerPermits` and `totalAvailablePermits`.
Then we verify that `firstAvailableConsumerPermits > 0` __and__
`max(totalAvailablePermits, firstAvailableConsumerPermits) > 0`. But the second
check is redundant at that point, since it is guaranteed to be true. So I
simplified the condition.
--
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]