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

Add configured timeouts to EventProcessor #89

Merged
merged 2 commits into from
Feb 24, 2017
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
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