Skip to content

Commit

Permalink
Merge pull request #595 from hiddenalpha/RespondFailureImmediatelyInP…
Browse files Browse the repository at this point in the history
…laceOfWaitingForTimeoutDueToIllegalStateException-20240617

[SDCISA-16207] Respond failure immediately in place of waiting for timeout
  • Loading branch information
hiddenalpha authored Jun 17, 2024
2 parents 4d4f62a + b32ac56 commit 5e0b379
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ private Handler<AsyncResult<HttpClientResponse>> getAsyncHttpClientResponseHandl

final LoggingWriteStream loggingWriteStream = new LoggingWriteStream(req.response(), loggingHandler, false);
final Pump pump = Pump.pump(cRes, loggingWriteStream);
cRes.endHandler(v -> {
Handler<Void> cResEndHandler = v -> {
try {
req.response().end();

Expand All @@ -516,7 +516,14 @@ private Handler<AsyncResult<HttpClientResponse>> getAsyncHttpClientResponseHandl
// ignore because maybe already closed
}
vertx.runOnContext(event -> loggingHandler.log());
});
};
try {
cRes.endHandler(cResEndHandler);
} catch (IllegalStateException ex) {
log.warn("cRes.endHandler() failed", ex);
respondError(req, StatusCode.INTERNAL_SERVER_ERROR);
return;
}
pump.start();

Runnable unpump = () -> {
Expand Down

0 comments on commit 5e0b379

Please sign in to comment.