diff options
author | Jon Bratseth <bratseth@gmail.com> | 2023-03-10 18:31:05 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2023-03-10 18:31:05 +0100 |
commit | 315c1feec1ac67f97419d910550f4aebfe9290a7 (patch) | |
tree | bb5ae526f63fd22cad1533950c151f4047a11d1d /node-repository/src/main/java/com/yahoo | |
parent | 3881033cffca4d8461c076e26717d9493c3bac13 (diff) |
Cooldown from completion rather than start of scaling
Diffstat (limited to 'node-repository/src/main/java/com/yahoo')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java index 281d9efe51a..2f9ad28a072 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java @@ -243,8 +243,10 @@ public class ClusterModel { } private boolean hasScaledIn(Duration period) { - return cluster.lastScalingEvent().map(event -> event.at()).orElse(Instant.MIN) - .isAfter(clock.instant().minus(period)); + if (cluster.lastScalingEvent().isEmpty()) return false; + var lastCompletion = cluster.lastScalingEvent().get().completion(); + if (lastCompletion.isEmpty()) return true; // Ongoing + return lastCompletion.get().isAfter(clock.instant().minus(period)); } private ClusterNodesTimeseries nodeTimeseries() { return nodeTimeseries; } |