michaeljmarshall commented on a change in pull request #14870:
URL: https://github.com/apache/pulsar/pull/14870#discussion_r835447418



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -1802,6 +1802,10 @@ private void resendMessages(ClientCnx cnx, long 
expectedEpoch) {
                     cnx.channel().close();
                     return;
                 }
+
+                if (isBatchMessagingEnabled()) {
+                    batchMessageAndSend(false);
+                }

Review comment:
       What do you think about instead calling `scheduleBatchFlushTask(0)` in 
the below code block? For example:
   
   ```java
                       if (changeToReadyState()) {
                           producerCreatedFuture.complete(ProducerImpl.this);
                           scheduleBatchFlushTask(0);
                           return;
                       } else {
   ```
   
   The advantage of this solution is that users with a longer 
`BatchingMaxPublishDelayMicros` won't end up with under-filled batches because 
the underlying logic of `scheduleBatchFlushTask` verifies that the batch hasn't 
been flushed too recently. This might happen in scenarios where the client 
briefly gets disconnected from the broker.




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