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_r181181049
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
 ##########
 @@ -399,24 +408,39 @@ protected void 
handleReachedEndOfTopic(CommandReachedEndOfTopic commandReachedEn
         }
     }
 
-    private boolean addPendingLookupRequests(long requestId, 
CompletableFuture<LookupDataResult> future) {
-        if (pendingLookupRequestSemaphore.tryAcquire()) {
-            pendingLookupRequests.put(requestId, future);
-            eventLoopGroup.schedule(() -> {
-                if (!future.isDone()) {
-                    future.completeExceptionally(new TimeoutException(
-                            requestId + " lookup request timedout after ms " + 
operationTimeoutMs));
-                }
-            }, operationTimeoutMs, TimeUnit.MILLISECONDS);
-            return true;
-        }
-        return false;
+    private void addPendingLookupRequests(long requestId, 
CompletableFuture<LookupDataResult> future) {
 
 Review comment:
   better to leave a comment that the caller of this method needs to be 
protected under a semaphore

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