Skip to content

Change mapping of connectionRequestTimeout to ConnPool leaseTimeout #1925

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

Merged
merged 1 commit into from
Sep 10, 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
Expand Up @@ -55,6 +55,7 @@
* @author Huw Ayling-Miller
* @author Henrique Amaral
* @author Peter-Josef Meisch
* @author Nic Hines
* @since 3.2
*/
public final class RestClients {
Expand Down Expand Up @@ -105,15 +106,14 @@ public static ElasticsearchRestClient create(ClientConfiguration clientConfigura
Duration connectTimeout = clientConfiguration.getConnectTimeout();

if (!connectTimeout.isNegative()) {

requestConfigBuilder.setConnectTimeout(Math.toIntExact(connectTimeout.toMillis()));
requestConfigBuilder.setConnectionRequestTimeout(Math.toIntExact(connectTimeout.toMillis()));
}

Duration timeout = clientConfiguration.getSocketTimeout();

if (!timeout.isNegative()) {
requestConfigBuilder.setSocketTimeout(Math.toIntExact(timeout.toMillis()));
requestConfigBuilder.setConnectionRequestTimeout(Math.toIntExact(connectTimeout.toMillis()));
Comment on lines 114 to +116
Copy link
Collaborator

Choose a reason for hiding this comment

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

just at a second look I saw that you moved the line into the if for the socketTimeout, but still using the configured value for the connectTimeout. Shouldn't do PRs in the morning before work. I'll fix that.

}

clientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
Expand Down