From 5773abc64ed26bf39cd387c1d446f904529886bc Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Mon, 10 Jul 2023 12:50:36 +0200 Subject: Set timeouts on connector --- .../src/main/java/ai/vespa/feed/client/impl/JettyCluster.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vespa-feed-client') diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java index 79fe8dd630f..58838e5a597 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java @@ -124,6 +124,8 @@ class JettyCluster implements Cluster { int threads = Math.max(Math.min(Runtime.getRuntime().availableProcessors(), 32), 8); connector.setExecutor(new QueuedThreadPool(threads)); connector.setSslContextFactory(clientSslCtxFactory); + connector.setIdleTimeout(IDLE_TIMEOUT); + connector.setConnectTimeout(Duration.ofSeconds(10)); HTTP2Client h2Client = new HTTP2Client(connector); h2Client.setMaxConcurrentPushedStreams(b.maxStreamsPerConnection); // Set the HTTP/2 flow control windows very large to cause TCP congestion instead of HTTP/2 flow control congestion. @@ -141,12 +143,10 @@ class JettyCluster implements Cluster { httpClient.setFollowRedirects(false); httpClient.setUserAgentField( new HttpField(HttpHeader.USER_AGENT, String.format("vespa-feed-client/%s (Jetty)", Vespa.VERSION))); - httpClient.setConnectTimeout(Duration.ofSeconds(10).toMillis()); // Stop client from trying different IP address when TLS handshake fails httpClient.setSocketAddressResolver(new Ipv4PreferringResolver(httpClient, Duration.ofSeconds(10))); httpClient.setCookieStore(new HttpCookieStore.Empty()); - httpClient.setIdleTimeout(IDLE_TIMEOUT.toMillis()); try { httpClient.start(); } catch (Exception e) { -- cgit v1.2.3