BewareMyPower commented on code in PR #15852:
URL: https://github.com/apache/pulsar/pull/15852#discussion_r885263905


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ZeroQueueConsumerImpl.java:
##########
@@ -84,11 +84,20 @@ protected Message<T> internalReceive() throws 
PulsarClientException {
 
     @Override
     protected CompletableFuture<Message<T>> internalReceiveAsync() {
+        // Just being cautious
+        if (incomingMessages.size() > 0) {
+            log.error("The incoming message queue should never be greater than 
0 when Queue size is 0");
+            incomingMessages.forEach(Message::release);
+            incomingMessages.clear();
+        }

Review Comment:
   Zero queue consumer never caches messages in `incomingMessages`, the check 
is meaningless. Though I see the same code in `internalReceive`.
   
   I think we should remove this code block or just use `assert` instead.



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