diff options
author | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-09-16 13:08:47 +0200 |
---|---|---|
committer | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-09-16 13:08:47 +0200 |
commit | d566595246d533789a525c03e29fcd48b548dcc7 (patch) | |
tree | 5c273b30fbf2715b94b9b0011183332beed5da40 /vespa-http-client | |
parent | 9435c52737dada1a74f8d49edd7a451e4f9b61cb (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.java | 4 |
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) { |