sijie commented on a change in pull request #1538: Add rate limit for client 
lookup requests
URL: https://github.com/apache/incubator-pulsar/pull/1538#discussion_r181183798
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
 ##########
 @@ -508,8 +533,14 @@ protected boolean isHandshakeCompleted() {
             if (log.isDebugEnabled()) {
                 log.debug("{} Failed to add lookup-request into pending 
queue", requestId);
             }
-            future.completeExceptionally(new 
PulsarClientException.TooManyRequestsException(
-                    "Failed due to too many pending lookup requests"));
+            if (waitingLookupRequestSemaphore.tryAcquire()) {
+                waitingLookupRequests.add(Pair.of(requestId, Pair.of(request, 
future)));
+            } else {
+                future.completeExceptionally(new 
PulsarClientException.TooManyRequestsException(
 
 Review comment:
   I think the logging here can be improved.
   
   it is essentially saying - "There are {x} lookup request outstanding and {y} 
request pending", x limited by `concurrentLookupRequest` while y limited by 
`maxLookupRequest`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to