merlimat commented on a change in pull request #1184: Add connection timeout 
for binary lookup request
URL: https://github.com/apache/incubator-pulsar/pull/1184#discussion_r166198645
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
 ##########
 @@ -332,6 +346,12 @@ 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 " + 
DEFAULT_CONNECT_TIMEOUT_IN_SECONDS));
+                }
+            }, DEFAULT_CONNECT_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS);
 
 Review comment:
   I think we should be really using the `operationTimeout` that is 
configurable on the Client itself. 
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to