summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-09-08 12:12:43 +0200
committerJon Bratseth <bratseth@gmail.com>2020-09-08 12:12:43 +0200
commitdff0d984644570f492e1eccd5f3a8e8d2604afad (patch)
tree7bb7dd88699eae251c509a8e55d64f2649cdbc3b /node-repository
parent95d873edbe5634f8cfc4b38942c2bfefdcead5a5 (diff)
Act only if the target changes
If we have already computed a new target but not successfully changed to it, the autoscaler will return the same target. Don't take any action (log target, deploy immediately) when this happens.
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
index e2b98d8d000..572fab44418 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
@@ -67,11 +67,12 @@ public class AutoscalingMaintainer extends NodeRepositoryMaintainer {
Optional<Cluster> cluster = application.cluster(clusterId);
if (cluster.isEmpty()) return;
Optional<ClusterResources> target = autoscaler.autoscale(cluster.get(), clusterNodes);
- if ( ! cluster.get().targetResources().equals(target))
+ if ( ! cluster.get().targetResources().equals(target)) { // New target: Log and try to deploy now
applications().put(application.with(cluster.get().withTarget(target)), deployment.applicationLock().get());
- if (target.isPresent()) {
- logAutoscaling(target.get(), applicationId, clusterId, clusterNodes);
- deployment.activate();
+ if (target.isPresent()) {
+ logAutoscaling(target.get(), applicationId, clusterId, clusterNodes);
+ deployment.activate();
+ }
}
}