wangjialing218 commented on a change in pull request #13204:
URL: https://github.com/apache/pulsar/pull/13204#discussion_r769172476
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2274,6 +2288,22 @@ private void updateManagedLedgerConfig() {
configRegisteredListeners.put(configKey, listener);
}
+ public <T> void
registerPublishBufferLimitListener(Consumer<PublishBufferEvent> listener) {
+ publishBufferLimitListeners.add(listener);
+ }
+
+ private void checkPulishBufferLimit() {
+ publishBufferLimitListeners.forEach(listener -> {
+ if (totalPendingBytes.sum() > maxPendingBytes && maxPendingBytes >
0) {
Review comment:
maxPendingBytes < 0 meaning disable buffer size limit. Please do this
check before `sum()` to avoid unnecessary CPU work.
--
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]