Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor read timeout in reactive rest client #19223

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -166,6 +166,10 @@ public Future<HttpClientRequest> createRequest(RestClientRequestContext state) {
requestOptions.setURI(uri.getPath() + (uri.getQuery() == null ? "" : "?" + uri.getQuery()));
requestOptions.setFollowRedirects(followRedirects);
requestOptions.setSsl(isHttps);
Object readTimeout = state.getConfiguration().getProperty(QuarkusRestClientProperties.READ_TIMEOUT);
if (readTimeout instanceof Long) {
requestOptions.setTimeout((Long) readTimeout);
}
return httpClient.request(requestOptions);
}

Original file line number Diff line number Diff line change
@@ -10,8 +10,6 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.CompletionStageRxInvoker;
@@ -197,8 +195,8 @@ private <T> T unwrap(CompletableFuture<T> c) {
throw new BlockingNotAllowedException();
}
try {
return c.get(readTimeoutMs, TimeUnit.MILLISECONDS);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed (and is actually incorrect) as the timeout handling is performed by Vert.x

} catch (InterruptedException | TimeoutException e) {
return c.get();
} catch (InterruptedException e) {
throw new ProcessingException(e);
} catch (ExecutionException e) {
if (e.getCause() instanceof ProcessingException) {