Skip to content

Commit

Permalink
check batchBuilder in case batch is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzming committed Sep 28, 2023
1 parent ac9c1a6 commit d403de1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,12 @@ 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
Expand Down

0 comments on commit d403de1

Please sign in to comment.