Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #89 from launchdarkly/arun/eventprocessor-timeout
Browse files Browse the repository at this point in the history
Add configured timeouts to EventProcessor
  • Loading branch information
arun251 authored Feb 24, 2017
2 parents cd9cb60 + 72941a3 commit e7092ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/com/launchdarkly/client/EventProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.gson.Gson;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
Expand Down Expand Up @@ -62,7 +63,14 @@ class Consumer implements Runnable {

Consumer(LDConfig config) {
this.config = config;
client = HttpClients.custom().setProxy(config.proxyHost).build();
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(config.connectTimeout)
.setSocketTimeout(config.socketTimeout)
.setProxy(config.proxyHost)
.build();
client = HttpClients.custom()
.setDefaultRequestConfig(requestConfig)
.build();
}

@Override
Expand Down

0 comments on commit e7092ea

Please sign in to comment.