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/06/10 08:07:22 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #15974: [fix][admin] Release LookupRequestSemaphore before returning data.

codelipenghui commented on code in PR #15974:
URL: https://github.com/apache/pulsar/pull/15974#discussion_r894264775


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/lookup/TopicLookupBase.java:
##########
@@ -127,6 +127,7 @@ protected CompletableFuture<LookupData> internalLookupTopicAsync(TopicName topic
                                 log.debug("Lookup succeeded for topic {} -- broker: {}", topicName,
                                         result.getLookupData());
                             }
+                            pulsar().getBrokerService().getLookupRequestSemaphore().release();

Review Comment:
   Can we move the semaphore release out of the `completeLookupResponseExceptionally`
   
   ```
       protected void completeLookupResponseExceptionally(AsyncResponse asyncResponse, Throwable t) {
           pulsar().getBrokerService().getLookupRequestSemaphore().release();
           Throwable cause = FutureUtil.unwrapCompletionException(t);
           asyncResponse.resume(cause);
       }
   ```
   
   And make sure `internalLookupTopicAsync` will acquire the lock and release the lock property.
   It's easier to read and maintain, reduces mistakes later.



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