codelipenghui commented on a change in pull request #10831:
URL: https://github.com/apache/pulsar/pull/10831#discussion_r645926724
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
##########
@@ -673,7 +673,10 @@ protected int getFirstAvailableConsumerPermits() {
}
for (Consumer consumer : consumerList) {
if (isConsumerAvailable(consumer)) {
- return consumer.getAvailablePermits();
+ int availablePermits = consumer.getAvailablePermits();
+ if (availablePermits > 0) {
+ return availablePermits;
+ }
}
Review comment:
Is better to change to:
```
if (consumer != null && !consumer.isBlocked()) {
return consumer.getAvailablePermits();
}
```
So that we don't need to check `availablePermits` twice
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]