315157973 commented on a change in pull request #9261:
URL: https://github.com/apache/pulsar/pull/9261#discussion_r561854532
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
##########
@@ -774,16 +767,17 @@ protected void notifyPendingBatchReceivedCallBack() {
protected final void notifyPendingBatchReceivedCallBack(OpBatchReceive<T>
opBatchReceive) {
MessagesImpl<T> messages = getNewMessagesImpl();
- Message<T> msgPeeked = incomingMessages.peek();
- while (msgPeeked != null && messages.canAdd(msgPeeked)) {
- Message<T> msg = incomingMessages.poll();
+
+ Message<T> msg = null;
+ do {
+ msg = incomingMessages.poll();
if (msg != null) {
messageProcessed(msg);
Message<T> interceptMsg = beforeConsume(msg);
messages.add(interceptMsg);
}
- msgPeeked = incomingMessages.peek();
- }
+ } while (msg != null && messages.canAdd());
Review comment:
This will make the message size in the collection exceed the limit
----------------------------------------------------------------
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:
[email protected]