Skip to content

Commit

Permalink
merge: #8554
Browse files Browse the repository at this point in the history
8554: [Backport stable/1.3] fix(atomix/netty): remove open future when request times out r=oleschoenburg a=github-actions[bot]

# Description
Backport of #8550 to `stable/1.3`.

relates to #8541

Co-authored-by: Roman <roman.smirnov@camunda.com>
  • Loading branch information
zeebe-bors-cloud[bot] and romansmirnov committed Jan 7, 2022
2 parents 59fb529 + c984bb1 commit 0730107
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,13 @@ public CompletableFuture<byte[]> sendAndReceive(

final var timeoutFuture =
timeoutExecutor.schedule(
() ->
responseFuture.completeExceptionally(
new TimeoutException(
String.format(
"Request %s to %s timed out in %s", message, address, timeout))),
() -> {
responseFuture.completeExceptionally(
new TimeoutException(
String.format(
"Request %s to %s timed out in %s", message, address, timeout)));
openFutures.remove(responseFuture);
},
timeout.toNanos(),
TimeUnit.NANOSECONDS);
responseFuture.whenComplete((ignored, error) -> timeoutFuture.cancel(true));
Expand Down

0 comments on commit 0730107

Please sign in to comment.