Skip to content

Commit

Permalink
Update kafka message pool to avoid unnecessary heap allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmtszr committed Jan 6, 2023
1 parent dec1325 commit c03e6a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kafka/producer/producer_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (b *producerBatch) StartBatch() {

case message := <-b.messageChn:
b.messages = append(b.messages, *message)
KafkaMessagePool.Put(message)
if len(b.messages) == b.batchLimit {
err := b.FlushMessages()
if err != nil {
Expand Down

0 comments on commit c03e6a6

Please sign in to comment.