aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorHaakon Dybdahl <dybdahl@yahoo-inc.com>2016-09-16 13:08:47 +0200
committerHaakon Dybdahl <dybdahl@yahoo-inc.com>2016-09-16 13:08:47 +0200
commitd566595246d533789a525c03e29fcd48b548dcc7 (patch)
tree5c273b30fbf2715b94b9b0011183332beed5da40 /vespa-http-client
parent9435c52737dada1a74f8d49edd7a451e4f9b61cb (diff)
Do not wait forever in close, in some cases the queue will get drained too slowly.
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java
index 62a93c84f79..64836ccb20d 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java
@@ -11,6 +11,7 @@ import com.yahoo.vespa.http.client.core.operationProcessor.OperationProcessor;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
+import java.time.Instant;
import java.util.concurrent.ScheduledThreadPoolExecutor;
/**
@@ -52,7 +53,8 @@ public class FeedClientImpl implements FeedClient {
@Override
public void close() {
- while (operationProcessor.getIncompleteResultQueueSize() > 0) {
+ Instant startTime = Instant.now();
+ while (operationProcessor.getIncompleteResultQueueSize() > 0 && startTime.plusSeconds(30).isAfter(Instant.now())) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {