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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7f60ab9  Remove useless code in `encodeBatch()` (#783)
7f60ab9 is described below

commit 7f60ab9f1815ff34cdc2d457263f2c53d1b241bc
Author: Zero <[email protected]>
AuthorDate: Thu Jul 21 17:32:50 2022 +0800

    Remove useless code in `encodeBatch()` (#783)
---
 producer/producer.go | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/producer/producer.go b/producer/producer.go
index 87769ab..ef217e4 100644
--- a/producer/producer.go
+++ b/producer/producer.go
@@ -130,15 +130,8 @@ func (p *defaultProducer) encodeBatch(msgs 
...*primitive.Message) *primitive.Mes
        batch := new(primitive.Message)
        batch.Topic = msgs[0].Topic
        batch.Queue = msgs[0].Queue
-       if len(msgs) > 1 {
-               batch.Body = MarshalMessageBatch(msgs...)
-               batch.Batch = true
-       } else {
-               batch.Body = msgs[0].Body
-               batch.Flag = msgs[0].Flag
-               batch.WithProperties(msgs[0].GetProperties())
-               batch.TransactionId = msgs[0].TransactionId
-       }
+       batch.Body = MarshalMessageBatch(msgs...)
+       batch.Batch = true
        return batch
 }
 

Reply via email to