You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/12/16 04:47:43 UTC
[GitHub] [pulsar-client-go] wolfstudy commented on a change in pull request
#124: [Issue #123] Ensure message is sent if no room in current batch.
wolfstudy commented on a change in pull request #124: [Issue #123] Ensure message is sent if no room in current batch.
URL: https://github.com/apache/pulsar-client-go/pull/124#discussion_r358051717
##########
File path: pulsar/producer_partition.go
##########
@@ -256,10 +256,17 @@ func (p *partitionProducer) internalSend(request *sendRequest) {
}
if sendAsBatch {
- ok := p.batchBuilder.Add(smm, sequenceID, msg.Payload, request, msg.ReplicationClusters)
- if ok == false {
+ added := p.batchBuilder.Add(smm, sequenceID, msg.Payload, request, msg.ReplicationClusters)
+ if !added {
// The current batch is full.. flush it and retry
p.internalFlushCurrentBatch()
+
+ // after flushing try again to add the current payload
+ if ok := p.batchBuilder.Add(smm, sequenceID, msg.Payload, request, msg.ReplicationClusters); !ok {
+ p.log.WithField("size", len(msg.Payload)).
+ WithField("sequenceID", sequenceID).
+ Error("unable to send message")
+ }
}
} else {
// Send individually
Review comment:
Agree with @tuteng
```
if add := p.batchBuilder.Add(smm, sequenceID, msg.Payload, request, msg.ReplicationClusters); !add {
//print warn log
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services