diff options
author | jonmv <venstad@gmail.com> | 2022-08-11 16:16:11 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-08-11 16:16:11 +0200 |
commit | 5f46b531be2a88e42e69e94af24330ad68fafa35 (patch) | |
tree | 7b7b3059cd39c74dcd28ef20aa3e9b2ef43b498f | |
parent | 6491f03e2cfb7647d4435f2e227a798992946146 (diff) |
Simplify some optional magic :)
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index b9432fdc375..78063a383dc 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -550,10 +550,9 @@ public class ApplicationController { controller.jobController().deploymentStatus(application.get()); for (Notification notification : controller.notificationsDb().listNotifications(NotificationSource.from(application.get().id()), true)) { - if ( ! notification.source().instance().map(declaredInstances::contains).orElse(true)) - controller.notificationsDb().removeNotifications(notification.source()); - if (notification.source().instance().isPresent() && - ! notification.source().zoneId().map(application.get().require(notification.source().instance().get()).deployments()::containsKey).orElse(false)) + if ( notification.source().instance().isPresent() + && ( ! declaredInstances.contains(notification.source().instance().get()) + || ! notification.source().zoneId().map(application.get().require(notification.source().instance().get()).deployments()::containsKey).orElse(false))) controller.notificationsDb().removeNotifications(notification.source()); } @@ -647,7 +646,7 @@ public class ApplicationController { .filter(zone -> deploymentSpec.instance(instance).isEmpty() || ! deploymentSpec.requireInstance(instance).deploysTo(zone.environment(), zone.region())) - .collect(toList()); + .toList(); if (deploymentsToRemove.isEmpty()) return application; |