poorbarcode commented on code in PR #22245:
URL: https://github.com/apache/pulsar/pull/22245#discussion_r1543568051
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:
##########
@@ -437,6 +436,82 @@ protected synchronized NavigableSet<PositionImpl>
getMessagesToReplayNow(int max
}
}
+ private int getAvailablePermits(Consumer c) {
+ int availablePermits = Math.max(c.getAvailablePermits(), 0);
+ if (c.getMaxUnackedMessages() > 0) {
+ // Avoid negative number
+ int remainUnAckedMessages = Math.max(c.getMaxUnackedMessages() -
c.getUnackedMessages(), 0);
+ availablePermits = Math.min(availablePermits,
remainUnAckedMessages);
+ }
+ return availablePermits;
+ }
+
+ @Override
+ protected NavigableSet<PositionImpl>
filterOutEntriesWillBeDiscarded(NavigableSet<PositionImpl> src) {
Review Comment:
Done
--
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]