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 2022/05/31 13:53:00 UTC

[GitHub] [pulsar] mattisonchao commented on a diff in pull request #15852: [fix][client] `ZeroQueueConsumer` may not increase the permit after unloading the topic.

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


##########
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();
+        }
         CompletableFuture<Message<T>> future = super.internalReceiveAsync();
+        waitingOnReceiveForZeroQueueSize = true;

Review Comment:
   Yes, after this PR, maybe we can use `internalReceiveAsync ` directly.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org