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 2021/12/15 01:26:36 UTC

[GitHub] [pulsar] wangjialing218 commented on a change in pull request #13204: support limit message size produced by protocol handlers by maxMessag…

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

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