diff --git a/core/src/main/java/com/linecorp/armeria/client/AbstractHttpResponseDecoder.java b/core/src/main/java/com/linecorp/armeria/client/AbstractHttpResponseDecoder.java index e1ba730eb38..c477c008389 100644 --- a/core/src/main/java/com/linecorp/armeria/client/AbstractHttpResponseDecoder.java +++ b/core/src/main/java/com/linecorp/armeria/client/AbstractHttpResponseDecoder.java @@ -62,8 +62,7 @@ public HttpResponseWrapper addResponse(@Nullable AbstractHttpRequestHandler requ int id, DecodedHttpResponse res, ClientRequestContext ctx, EventLoop eventLoop) { final HttpResponseWrapper newRes = - new HttpResponseWrapper(requestHandler, res, eventLoop, ctx, - ctx.responseTimeoutMillis(), ctx.maxResponseLength()); + new HttpResponseWrapper(requestHandler, res, eventLoop, ctx, ctx.maxResponseLength()); final HttpResponseWrapper oldRes = responses.put(id, newRes); keepAliveHandler().increaseNumRequests(); diff --git a/core/src/main/java/com/linecorp/armeria/client/HttpResponseWrapper.java b/core/src/main/java/com/linecorp/armeria/client/HttpResponseWrapper.java index 27aafaabd9c..dfd3a91fb6a 100644 --- a/core/src/main/java/com/linecorp/armeria/client/HttpResponseWrapper.java +++ b/core/src/main/java/com/linecorp/armeria/client/HttpResponseWrapper.java @@ -58,7 +58,6 @@ class HttpResponseWrapper implements StreamWriter { private final EventLoop eventLoop; private final ClientRequestContext ctx; private final long maxContentLength; - private final long responseTimeoutMillis; private boolean responseStarted; private long contentLengthHeaderValue = -1; @@ -66,15 +65,14 @@ class HttpResponseWrapper implements StreamWriter { private boolean done; private boolean closed; - HttpResponseWrapper(@Nullable AbstractHttpRequestHandler requestHandler, - DecodedHttpResponse delegate, EventLoop eventLoop, ClientRequestContext ctx, - long responseTimeoutMillis, long maxContentLength) { + HttpResponseWrapper(@Nullable AbstractHttpRequestHandler requestHandler, DecodedHttpResponse delegate, + EventLoop eventLoop, ClientRequestContext ctx, long maxContentLength) { + this.requestHandler = requestHandler; this.delegate = delegate; this.eventLoop = eventLoop; this.ctx = ctx; this.maxContentLength = maxContentLength; - this.responseTimeoutMillis = responseTimeoutMillis; } void handle100Continue(ResponseHeaders responseHeaders) { @@ -327,7 +325,6 @@ public String toString() { .add("eventLoop", eventLoop) .add("responseStarted", responseStarted) .add("maxContentLength", maxContentLength) - .add("responseTimeoutMillis", responseTimeoutMillis) .add("contentLengthHeaderValue", contentLengthHeaderValue) .add("delegate", delegate) .toString(); diff --git a/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ClientChannelHandler.java b/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ClientChannelHandler.java index f80cbe0c4c7..cf6d0171792 100644 --- a/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ClientChannelHandler.java +++ b/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ClientChannelHandler.java @@ -100,8 +100,7 @@ public HttpResponseWrapper addResponse(@Nullable AbstractHttpRequestHandler requ int id, DecodedHttpResponse decodedHttpResponse, ClientRequestContext ctx, EventLoop eventLoop) { assert res == null; - res = new WebSocketHttp1ResponseWrapper(decodedHttpResponse, eventLoop, ctx, - ctx.responseTimeoutMillis(), ctx.maxResponseLength()); + res = new WebSocketHttp1ResponseWrapper(decodedHttpResponse, eventLoop, ctx, ctx.maxResponseLength()); return res; } diff --git a/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ResponseWrapper.java b/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ResponseWrapper.java index 6d920f7116f..47abd673080 100644 --- a/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ResponseWrapper.java +++ b/core/src/main/java/com/linecorp/armeria/client/WebSocketHttp1ResponseWrapper.java @@ -26,9 +26,8 @@ final class WebSocketHttp1ResponseWrapper extends HttpResponseWrapper { WebSocketHttp1ResponseWrapper(DecodedHttpResponse delegate, - EventLoop eventLoop, ClientRequestContext ctx, - long responseTimeoutMillis, long maxContentLength) { - super(null, delegate, eventLoop, ctx, responseTimeoutMillis, maxContentLength); + EventLoop eventLoop, ClientRequestContext ctx, long maxContentLength) { + super(null, delegate, eventLoop, ctx, maxContentLength); WebSocketClientUtil.setClosingResponseTask(ctx, cause -> { super.close(cause, false); }); diff --git a/core/src/main/java/com/linecorp/armeria/internal/client/DefaultClientRequestContext.java b/core/src/main/java/com/linecorp/armeria/internal/client/DefaultClientRequestContext.java index ed3fbfc662a..4ad2e2bdeee 100644 --- a/core/src/main/java/com/linecorp/armeria/internal/client/DefaultClientRequestContext.java +++ b/core/src/main/java/com/linecorp/armeria/internal/client/DefaultClientRequestContext.java @@ -540,8 +540,7 @@ private DefaultClientRequestContext(DefaultClientRequestContext ctx, log.startRequest(); // Cancel the original timeout and create a new scheduler for the derived context. ctx.responseCancellationScheduler.cancelScheduled(); - responseCancellationScheduler = - CancellationScheduler.ofClient(ctx.remainingTimeoutNanos()); + responseCancellationScheduler = CancellationScheduler.ofClient(ctx.remainingTimeoutNanos()); writeTimeoutMillis = ctx.writeTimeoutMillis(); maxResponseLength = ctx.maxResponseLength(); diff --git a/core/src/test/java/com/linecorp/armeria/client/retry/ResponseTimeoutFromStartTest.java b/core/src/test/java/com/linecorp/armeria/client/retry/ResponseTimeoutFromStartTest.java index 55426d6fb3a..077f2f88106 100644 --- a/core/src/test/java/com/linecorp/armeria/client/retry/ResponseTimeoutFromStartTest.java +++ b/core/src/test/java/com/linecorp/armeria/client/retry/ResponseTimeoutFromStartTest.java @@ -67,10 +67,6 @@ void originalResponseTimeoutRespected(long backoffMillis, long attemptMillis, lo WebClient.builder(server.httpUri()) .responseTimeout(Duration.ofSeconds(timeoutSeconds)) .responseTimeoutMode(ResponseTimeoutMode.FROM_START) - .decorator((delegate, ctx, req) -> { - logger.info("ctx.responseTimeoutMillis: {}", ctx.responseTimeoutMillis()); - return delegate.execute(ctx, req); - }) .decorator( RetryingClient.builder(RetryRule.builder() .onException()