diff options
Diffstat (limited to 'vespa-http-client/src')
2 files changed, 9 insertions, 5 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java index 547ea524041..68cca286dac 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java @@ -8,11 +8,11 @@ import com.yahoo.security.SslContextBuilder; import com.yahoo.vespa.http.client.config.ConnectionParams; import com.yahoo.vespa.http.client.config.Endpoint; import com.yahoo.vespa.http.client.config.FeedParams; -import com.yahoo.vespa.http.client.core.Vtag; import com.yahoo.vespa.http.client.core.Document; import com.yahoo.vespa.http.client.core.Encoder; import com.yahoo.vespa.http.client.core.Headers; import com.yahoo.vespa.http.client.core.ServerResponseException; +import com.yahoo.vespa.http.client.core.Vtag; import org.apache.http.Header; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; @@ -392,10 +392,12 @@ class ApacheGatewayConnection implements GatewayConnection { */ public static class HttpClientFactory { + private final FeedParams feedParams; final ConnectionParams connectionParams; final boolean useSsl; - public HttpClientFactory(ConnectionParams connectionParams, boolean useSsl) { + public HttpClientFactory(FeedParams feedParams, ConnectionParams connectionParams, boolean useSsl) { + this.feedParams = feedParams; this.connectionParams = connectionParams; this.useSsl = useSsl; } @@ -427,8 +429,10 @@ class ApacheGatewayConnection implements GatewayConnection { clientBuilder.setMaxConnTotal(1); clientBuilder.setUserAgent(String.format("vespa-http-client (%s)", Vtag.V_TAG_COMPONENT)); clientBuilder.setDefaultHeaders(Collections.singletonList(new BasicHeader(Headers.CLIENT_VERSION, Vtag.V_TAG_COMPONENT))); - RequestConfig.Builder requestConfigBuilder = RequestConfig.custom(); - requestConfigBuilder.setSocketTimeout(0); + int millisTotalTimeout = (int) (feedParams.getClientTimeout(TimeUnit.MILLISECONDS) + feedParams.getServerTimeout(TimeUnit.MILLISECONDS)); + RequestConfig.Builder requestConfigBuilder = RequestConfig.custom() + .setSocketTimeout(millisTotalTimeout) + .setConnectTimeout(millisTotalTimeout); if (connectionParams.getProxyHost() != null) { requestConfigBuilder.setProxy(new HttpHost(connectionParams.getProxyHost(), connectionParams.getProxyPort())); } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java index 16afd001c46..9dc214fb93d 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java @@ -78,7 +78,7 @@ public class ClusterConnection implements AutoCloseable { feedParams, cluster.getRoute(), connectionParams, - new ApacheGatewayConnection.HttpClientFactory(connectionParams, endpoint.isUseSsl()), + new ApacheGatewayConnection.HttpClientFactory(feedParams, connectionParams, endpoint.isUseSsl()), operationProcessor.getClientId(), clock ); |