Gleiphir2769 commented on code in PR #805:
URL: https://github.com/apache/pulsar-client-go/pull/805#discussion_r1002965643
##########
pulsar/internal/batch_builder.go:
##########
@@ -164,7 +167,11 @@ func (bc *batchContainer) hasSpace(payload []byte) bool {
return true
}
msgSize := uint32(len(payload))
- return bc.numMessages+1 <= bc.maxMessages &&
bc.buffer.ReadableBytes()+msgSize <= uint32(bc.maxBatchSize)
+ expectedSize := bc.buffer.ReadableBytes() + msgSize
Review Comment:
L171 compared the `bc.buffer.ReadableBytes() + msgSize` with
`bc.maxMessageSize` and the original code does not.
It used to make sure that one batch size does not exceed the
`maxMessageSize`. It's a part of correctly calculation whether the message is
too large.
By the way, the compare code is too long to be inline.
--
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]