aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2018-05-03 11:13:36 +0200
committerMartin Polden <mpolden@mpolden.no>2018-05-03 11:13:36 +0200
commitb6466a3d63eb967cc596b9242e77b13b96c04fb0 (patch)
tree986347c47b722ea0beeaade32964ade230dda08a
parentc67e70c45bcb27647a20387597f943fe6a09ffa2 (diff)
Shorten log message
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirer.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirer.java
index 9ca2f0ccddb..423f7f50aed 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirer.java
@@ -6,6 +6,7 @@ import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
import com.yahoo.vespa.hosted.controller.application.Deployment;
+import com.yahoo.yolean.Exceptions;
import java.time.Clock;
import java.time.Duration;
@@ -35,23 +36,27 @@ public class DeploymentExpirer extends Maintainer {
protected void maintain() {
for (Application application : controller().applications().asList()) {
for (Deployment deployment : application.deployments().values()) {
- if (deployment.zone().environment().equals(Environment.prod)) continue;
+ if (deployment.zone().environment().equals(Environment.prod)) {
+ continue;
+ }
- if (hasExpired(controller().zoneRegistry(), deployment, clock.instant()))
+ if (hasExpired(controller().zoneRegistry(), deployment, clock.instant())) {
try {
controller().applications().deactivate(application, deployment.zone());
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Could not expire " + deployment + " of " + application +
+ ": " + Exceptions.toMessageString(e) + ". Retrying in " +
+ maintenanceInterval());
}
- catch (Exception e) {
- log.log(Level.WARNING, "Could not expire " + deployment + " of " + application, e);
- }
+ }
}
}
}
- public static boolean hasExpired(ZoneRegistry zoneRegistry, Deployment deployment, Instant now) {
+ private static boolean hasExpired(ZoneRegistry zoneRegistry, Deployment deployment, Instant now) {
return zoneRegistry.getDeploymentTimeToLive(deployment.zone())
- .map(timeToLive -> deployment.at().plus(timeToLive).isBefore(now))
- .orElse(false);
+ .map(timeToLive -> deployment.at().plus(timeToLive).isBefore(now))
+ .orElse(false);
}
}