This is an automated email from the ASF dual-hosted git repository.

rxl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f8287f  [optimize] Stop batchFlushTicker when Disable batching (#720)
8f8287f is described below

commit 8f8287f30fc0cc90e9dea0003776491fef22eb33
Author: ZhangJian He <shoot...@gmail.com>
AuthorDate: Thu Feb 10 11:43:18 2022 +0800

    [optimize] Stop batchFlushTicker when Disable batching (#720)
    
    ### Motivation
    
    Disable batchFlushTicker when Disable batching, reduce cpu cost
    
    ### Modifications
    
    Stop the batchFlushTicker when Disable batching
---
 pulsar/producer_partition.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pulsar/producer_partition.go b/pulsar/producer_partition.go
index 913c33c..0e2e4c4 100644
--- a/pulsar/producer_partition.go
+++ b/pulsar/producer_partition.go
@@ -126,6 +126,9 @@ func newPartitionProducer(client *client, topic string, 
options *ProducerOptions
                metrics:          metrics,
                epoch:            0,
        }
+       if p.options.DisableBatching {
+               p.batchFlushTicker.Stop()
+       }
        p.setProducerState(producerInit)
 
        if options.Schema != nil && options.Schema.GetSchemaInfo() != nil {

Reply via email to