diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-07-05 12:36:24 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-07-05 12:36:24 +0200 |
commit | b6df83baa40127b3efa3fe4f084979e304415f49 (patch) | |
tree | 733dc4089d13a6911438490e35805f18c479930c /controller-server | |
parent | 82ef508085200f50b40e87a907dc592227ac7609 (diff) |
Catch excepptions also when getting confirmed owners
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java index 69e0eb26f16..7398b7e977e 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java @@ -17,7 +17,6 @@ import com.yahoo.yolean.Exceptions; import java.time.Duration; import java.util.HashMap; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; @@ -112,20 +111,29 @@ public class ApplicationOwnershipConfirmer extends ControllerMaintainer { } private double updateConfirmedApplicationOwners() { + AtomicInteger attempts = new AtomicInteger(0); + AtomicInteger failures = new AtomicInteger(0); applications() - .withProjectId() - .withProductionDeployment() - .asList() - .stream() - .filter(application -> application.ownershipIssueId().isPresent()) - .forEach(application -> { - IssueId ownershipIssueId = application.ownershipIssueId().get(); - ownershipIssues.getConfirmedOwner(ownershipIssueId).ifPresent(owner -> { - controller().applications().lockApplicationIfPresent(application.id(), lockedApplication -> - controller().applications().store(lockedApplication.withOwner(owner))); - }); - }); - return 1.0; + .withProjectId() + .withProductionDeployment() + .asList() + .stream() + .filter(application -> application.ownershipIssueId().isPresent()) + .forEach(application -> { + attempts.incrementAndGet(); + IssueId issueId = application.ownershipIssueId().get(); + try { + ownershipIssues.getConfirmedOwner(issueId).ifPresent(owner -> { + controller().applications().lockApplicationIfPresent(application.id(), lockedApplication -> + controller().applications().store(lockedApplication.withOwner(owner))); + }); + } + catch (RuntimeException e) { + failures.incrementAndGet(); + log.log(Level.INFO, "Exception caught when attempting to find confirmed owner of issue with id '" + issueId + "': " + Exceptions.toMessageString(e)); + } + }); + return asSuccessFactor(attempts.get(), failures.get()); } private ApplicationList applications() { |