diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2022-02-04 16:12:24 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2022-02-04 16:17:08 +0100 |
commit | 70aef157e29ddbd446453618397618c359b49367 (patch) | |
tree | a8c026dbc960d605444661d6818fdfdb4eb25cb2 | |
parent | 2ef2d3159c1763b624f7850b853f0c6c09377e8c (diff) |
Wait for results to be done processing before returning from close
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java index 6fec0029bc3..2d052e8a6af 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java @@ -19,6 +19,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; @@ -298,6 +299,14 @@ class HttpRequestStrategy implements RequestStrategy { inflightById.values().forEach(RetriableFuture::complete); cluster.close(); resultExecutor.shutdown(); + try { + if ( ! resultExecutor.awaitTermination(1, TimeUnit.MINUTES)) + log.log(WARNING, "Failed processing results within 1 minute"); + } + catch (InterruptedException e) { + log.log(WARNING, "Interrupted waiting for results to be processed"); + Thread.currentThread().interrupt(); + } } } |