aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java7
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java9
2 files changed, 13 insertions, 3 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java
index 376719aed1d..79c11cf86de 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java
@@ -156,11 +156,12 @@ public abstract class ControllerHttpClient {
public DeploymentLog followDeploymentUntilDone(ApplicationId id, ZoneId zone, long run,
Consumer<DeploymentLog.Entry> out) {
long last = -1;
- DeploymentLog log;
+ DeploymentLog log = null;
while (true) {
- log = deploymentLog(id, zone, run, last);
- for (DeploymentLog.Entry entry : log.entries())
+ DeploymentLog update = deploymentLog(id, zone, run, last);
+ for (DeploymentLog.Entry entry : update.entries())
out.accept(entry);
+ log = (log == null ? update : log.updatedWith(update));
last = log.last().orElse(last);
if ( ! log.isActive())
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
index 177c72107e0..9eae9a33cff 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
@@ -4,6 +4,7 @@ package ai.vespa.hosted.api;
import java.time.Instant;
import java.util.List;
import java.util.OptionalLong;
+import java.util.stream.Stream;
import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.toUnmodifiableList;
@@ -27,6 +28,14 @@ public class DeploymentLog {
this.last = last;
}
+ /** Returns this log updated with the content of the other. */
+ public DeploymentLog updatedWith(DeploymentLog other) {
+ return new DeploymentLog(Stream.concat(entries.stream(), other.entries.stream()).collect(toUnmodifiableList()),
+ other.active,
+ other.status,
+ other.last);
+ }
+
public List<Entry> entries() {
return entries;
}