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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to