Skip to content
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