Skip to content

Commit

Permalink
adding more logs to debug timeout error
Browse files Browse the repository at this point in the history
  • Loading branch information
srrangarajan committed Aug 22, 2022
1 parent ea7b3f0 commit d7c991d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static <T> CompletableFuture<T> withTimeout(CompletableFuture<T> future,
}

private static int getTimeoutSlots(int timeout) {
if(log.isDebugEnabled()) log.debug("Timeout is {}", timeout);
int timeoutSlots;
int val = timeout /10;
if (val == 0 ) {
Expand All @@ -256,6 +257,7 @@ private static int getTimeoutSlots(int timeout) {
} else {
timeoutSlots = 5;
}
if(log.isDebugEnabled()) log.debug("timeoutSlots is {}", timeoutSlots);
return timeoutSlots;
}

Expand All @@ -274,6 +276,7 @@ private static<T> CompletableFuture<Void> getNext(CompletableFuture<T> future,
scheduledTimeout =
LazySharedExecutor.executor.schedule(
() -> {
if(log.isDebugEnabled()) log.debug("Completing now for loop {} and timeout slot {}", j, timeoutSlots);
next.complete(null);
},
splitTimeout,
Expand All @@ -282,7 +285,7 @@ private static<T> CompletableFuture<Void> getNext(CompletableFuture<T> future,
scheduledTimeout =
LazySharedExecutor.executor.schedule(
() -> {
if(log.isDebugEnabled()) log.debug("Throwing timeout exception after {} {}", timeout, unit);
if(log.isDebugEnabled()) log.debug("Throwing timeout exception after {} {} with timeout slot {}", timeout, unit, timeoutSlots);
future.completeExceptionally(new TimeoutException("Timeout after " + timeout));
},
splitTimeout,
Expand Down

0 comments on commit d7c991d

Please sign in to comment.