pgier commented on code in PR #806:
URL: https://github.com/apache/pulsar-client-go/pull/806#discussion_r920270770


##########
pulsar/producer_partition.go:
##########
@@ -520,7 +520,12 @@ func (p *partitionProducer) internalSend(request 
*sendRequest) {
        }
 
        // if msg is too large
-       if len(payload) > int(p._getConn().GetMaxMessageSize()) {
+       minMessageSize := len(payload)
+       if minMessageSize > int(p._getConn().GetMaxMessageSize()) {
+               minMessageSize = len(p.batchBuilder.Compress(payload))
+       }
+
+       if minMessageSize > int(p._getConn().GetMaxMessageSize()) {

Review Comment:
   I think a short-circuit `and` will work here
   ```suggestion
        if len(payload) > int(p._getConn().GetMaxMessageSize()) && 
                len(p.batchBuilder.Compress(payload)) > 
int(p._getConn().GetMaxMessageSize()) {
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to