Skip to content

Commit

Permalink
small nits
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Dec 31, 2024
1 parent 47a777a commit c3a1334
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ private void handleRequest(

private void ensureRequestReceivedWithinTimeLimit(final RpcStream stream) {
asyncRunner
.getDelayedFuture(RECEIVE_INCOMING_REQUEST_TIMEOUT)
.thenAccept(
(__) -> {
.runAfterDelay(
() -> {
if (!requestHandled.get()) {
LOG.debug(
"Failed to receive incoming request data within {} sec for protocol {}. Close stream.",
RECEIVE_INCOMING_REQUEST_TIMEOUT.toSeconds(),
protocolId);
stream.closeAbruptly().ifExceptionGetsHereRaiseABug();
}
})
},
RECEIVE_INCOMING_REQUEST_TIMEOUT)
.ifExceptionGetsHereRaiseABug();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,32 +255,32 @@ private void ensureNextResponseChunkArrivesInTime(
final int previousResponseCount,
final AtomicInteger currentResponseCount) {
timeoutRunner
.getDelayedFuture(RESPONSE_CHUNK_ARRIVAL_TIMEOUT)
.thenAccept(
(__) -> {
.runAfterDelay(
() -> {
if (previousResponseCount == currentResponseCount.get()) {
abortRequest(
stream,
new RpcTimeoutException(
"Timed out waiting for response chunk " + previousResponseCount,
RESPONSE_CHUNK_ARRIVAL_TIMEOUT));
}
})
},
RESPONSE_CHUNK_ARRIVAL_TIMEOUT)
.ifExceptionGetsHereRaiseABug();
}

private void ensureReadCompleteArrivesInTime(final RpcStream stream) {
timeoutRunner
.getDelayedFuture(READ_COMPLETE_TIMEOUT)
.thenAccept(
(__) -> {
.runAfterDelay(
() -> {
if (!(state.get() == READ_COMPLETE || state.get() == CLOSED)) {
abortRequest(
stream,
new RpcTimeoutException(
"Timed out waiting for read channel close", READ_COMPLETE_TIMEOUT));
}
})
},
READ_COMPLETE_TIMEOUT)
.ifExceptionGetsHereRaiseABug();
}

Expand Down

0 comments on commit c3a1334

Please sign in to comment.