Skip to content

Commit 7f60ab9

Browse files
authored
Remove useless code in encodeBatch() (#783)
1 parent a7b2db6 commit 7f60ab9

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

producer/producer.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,8 @@ func (p *defaultProducer) encodeBatch(msgs ...*primitive.Message) *primitive.Mes
130130
batch := new(primitive.Message)
131131
batch.Topic = msgs[0].Topic
132132
batch.Queue = msgs[0].Queue
133-
if len(msgs) > 1 {
134-
batch.Body = MarshalMessageBatch(msgs...)
135-
batch.Batch = true
136-
} else {
137-
batch.Body = msgs[0].Body
138-
batch.Flag = msgs[0].Flag
139-
batch.WithProperties(msgs[0].GetProperties())
140-
batch.TransactionId = msgs[0].TransactionId
141-
}
133+
batch.Body = MarshalMessageBatch(msgs...)
134+
batch.Batch = true
142135
return batch
143136
}
144137

0 commit comments

Comments
 (0)