diff options
Diffstat (limited to 'vespa-http-client')
2 files changed, 6 insertions, 6 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 e4a3f91c33e..8a851bb72c0 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 @@ -60,13 +60,13 @@ public class FeedClientImpl implements FeedClient { @Override public void close() { - Instant lastResultReceived = Instant.now(); + Instant lastOldestResultReceivedAt = Instant.now(); Optional<String> oldestIncompleteId = operationProcessor.oldestIncompleteResultId(); - while (oldestIncompleteId.isPresent() && waitForOperations(lastResultReceived, sleepTimeMs, closeTimeoutMs)) { + while (oldestIncompleteId.isPresent() && waitForOperations(lastOldestResultReceivedAt, sleepTimeMs, closeTimeoutMs)) { Optional<String> oldestIncompleteIdNow = operationProcessor.oldestIncompleteResultId(); if ( ! oldestIncompleteId.equals(oldestIncompleteIdNow)) - lastResultReceived = Instant.now(); + lastOldestResultReceivedAt = Instant.now(); oldestIncompleteId = oldestIncompleteIdNow; } operationProcessor.close(); diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java index 24f27196394..d300bead9c1 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java @@ -109,9 +109,9 @@ public class OperationProcessor { /** Returns the id of the oldest operation to be sent. */ public Optional<String> oldestIncompleteResultId() { synchronized (monitor) { - return Optional.of(docSendInfoByOperationId.keySet().iterator()) - .filter(Iterator::hasNext) - .map(Iterator::next); + return docSendInfoByOperationId.isEmpty() + ? Optional.empty() + : Optional.of(docSendInfoByOperationId.keySet().iterator().next()); } } |