Skip to content

Commit

Permalink
Increased REST request timeout to 45 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Jun 30, 2022
1 parent 1c105e4 commit 3acb36c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/main/java/org/sunbird/portal/SbCbExtApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ public RestTemplate restTemplate() throws Exception {
}

private ClientHttpRequestFactory getClientHttpRequestFactory() {

int timeout = 30000;
RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout).setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout).build();
CloseableHttpClient client = HttpClientBuilder.create().setMaxConnTotal(2000).setMaxConnPerRoute(500)
.setDefaultRequestConfig(config).build();
HttpComponentsClientHttpRequestFactory cRequestFactory = new HttpComponentsClientHttpRequestFactory(client);
cRequestFactory.setReadTimeout(timeout);
return cRequestFactory;
int timeout = 45000;
RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout).setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout).build();
CloseableHttpClient client = HttpClientBuilder.create().setMaxConnTotal(2000).setMaxConnPerRoute(500)
.setDefaultRequestConfig(config).build();
HttpComponentsClientHttpRequestFactory cRequestFactory = new HttpComponentsClientHttpRequestFactory(client);
cRequestFactory.setReadTimeout(timeout);
return cRequestFactory;
}
}

0 comments on commit 3acb36c

Please sign in to comment.