You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/12/09 08:02:09 UTC

[GitHub] [pulsar] AnonHxy commented on a diff in pull request #18800: [improve][broker] Fast return if validalbe when getNextConsumerFromSameOrLowerLevel

AnonHxy commented on code in PR #18800:
URL: https://github.com/apache/pulsar/pull/18800#discussion_r1044182184


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherMultipleConsumers.java:
##########
@@ -189,10 +189,14 @@ private int getConsumerFromHigherPriority(int targetPriority) {
      * @return
      */
     private int getNextConsumerFromSameOrLowerLevel(int currentRoundRobinIndex) {
+        Consumer currentRRConsumer = consumerList.get(currentRoundRobinIndex);
+        if (isConsumerAvailable(currentRRConsumer)) {

Review Comment:
   Yes. This will make the code more clear with minor performance improvement by avoiding the first time check in the loop @Jason918 



-- 
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-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org