You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ni...@apache.org on 2023/11/01 15:35:50 UTC

(pulsar-client-go) branch master updated: [fix][issue 1098] check batchBuilder in case batch is disabled (#1099)

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

nicoloboschi 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 0845e738 [fix][issue 1098] check batchBuilder in case batch is disabled (#1099)
0845e738 is described below

commit 0845e7389affa855ee582489be30c6d4ac5766c0
Author: ming <it...@gmail.com>
AuthorDate: Wed Nov 1 11:35:45 2023 -0400

    [fix][issue 1098] check batchBuilder in case batch is disabled (#1099)
---
 pulsar/producer_partition.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pulsar/producer_partition.go b/pulsar/producer_partition.go
index 3b17190d..e214979d 100755
--- a/pulsar/producer_partition.go
+++ b/pulsar/producer_partition.go
@@ -724,6 +724,13 @@ type pendingItem struct {
 }
 
 func (p *partitionProducer) internalFlushCurrentBatch() {
+	if p.batchBuilder == nil {
+		// batch is not enabled
+		// the batch flush ticker should be stopped but it might still called once
+		// depends on when stop() is called concurrently
+		// so we add check to prevent the flow continues on a nil batchBuilder
+		return
+	}
 	if p.batchBuilder.IsMultiBatches() {
 		p.internalFlushCurrentBatches()
 		return