Skip to content

Commit

Permalink
Fix #825: Propagate connectionTimeout type change from core RestClien… (
Browse files Browse the repository at this point in the history
#826)

* Fix #825: Propagate connectionTimeout type change from core RestClientConfiguration
- Update usage of Duration-type connectionTimeout property
  • Loading branch information
jandusil authored Aug 10, 2023
1 parent 1b45ec5 commit 92bd871
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private static ReactiveOAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGr

private static WebClient createWebClient(final ExchangeFilterFunction filter, IProovConfigProps configProps, final String logContext) {
final RestClientConfiguration restClientConfig = configProps.getRestClientConfig();
final Integer connectionTimeout = restClientConfig.getConnectionTimeout();
final Duration connectionTimeout = restClientConfig.getConnectionTimeout();
final Duration responseTimeout = restClientConfig.getResponseTimeout();
final Duration maxIdleTime = Objects.requireNonNull(restClientConfig.getMaxIdleTime(), "maxIdleTime must be specified");
logger.info("Setting {} connectionTimeout: {}, responseTimeout: {}, maxIdleTime: {}", logContext, connectionTimeout, responseTimeout, maxIdleTime);
Expand All @@ -181,7 +181,7 @@ private static WebClient createWebClient(final ExchangeFilterFunction filter, IP
.maxIdleTime(maxIdleTime)
.build();
HttpClient httpClient = HttpClient.create(connectionProvider)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeout)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Math.toIntExact(connectionTimeout.toMillis()))
.responseTimeout(responseTimeout);

if (restClientConfig.isProxyEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public RestClient restClient(

final RestClientConfiguration config = new RestClientConfiguration();
config.setBaseUrl(url);
config.setConnectionTimeout((int) configuration.getConnectionTimeout().toMillis());
config.setConnectionTimeout(configuration.getConnectionTimeout());
config.setResponseTimeout(configuration.getResponseTimeout());
config.setHandshakeTimeout(configuration.getHandshakeTimeout());
config.setDefaultHttpHeaders(headers);
Expand Down

0 comments on commit 92bd871

Please sign in to comment.