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/06/21 17:22:15 UTC

[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #16160: [improve][java-client] Only trigger the batch receive timeout when having pending batch receives requests

michaeljmarshall commented on code in PR #16160:
URL: https://github.com/apache/pulsar/pull/16160#discussion_r902874267


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:
##########
@@ -164,12 +164,14 @@ protected ConsumerBase(PulsarClientImpl client, String topic, ConsumerConfigurat
             this.batchReceivePolicy = BatchReceivePolicy.DEFAULT_POLICY;
         }
 
+        initReceiverQueueSize();
+    }
+
+    protected void triggerBatchReceiveTimeoutTask() {

Review Comment:
   If I am reading this correctly, this method will get called with every call to `batchReceive` or `batchReceiveAsync`. That means we could end up with several concurrent timer tasks for a single consumer. The current solution only has one task at a time per consumer. Given that the `doPendingBatchReceiveTask` method schedules the next task based on the `diff` to the next `opBatchReceive` timeout, I think this method should only schedule a timer task when `batchReceiveTimeout` is `null`.



-- 
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