diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-12-17 22:27:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-17 22:27:20 +0100 |
commit | 9b2c6af8709da342560154230c7873ccf992d921 (patch) | |
tree | f0e082ccf4972caad95e8e2530831c60a8f6fd73 /controller-server | |
parent | 13c458c9a745bbb924ed6d785fc73964de15ebf4 (diff) | |
parent | 7a8f0df74c01b57fa92e05029f8960fc3767b173 (diff) |
Merge pull request #20575 from vespa-engine/jonmv/remove-stale-notifications
Remove all stale notifications on submissions
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java | 11 |
1 files changed, 7 insertions, 4 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 e7e7101aff7..39223d6c031 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 @@ -87,6 +87,7 @@ import java.util.Optional; import java.util.Set; import java.util.TreeMap; import java.util.function.Consumer; +import java.util.function.Predicate; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; @@ -436,10 +437,12 @@ public class ApplicationController { // Validate new deployment spec thoroughly before storing it. controller.jobController().deploymentStatus(application.get()); - // Clear notifications for instances that are no longer declared - for (var name : existingInstances) - if ( ! declaredInstances.contains(name)) - controller.notificationsDb().removeNotifications(NotificationSource.from(application.get().id().instance(name))); + for (Notification notification : controller.notificationsDb().listNotifications(NotificationSource.from(application.get().id()), true)) { + if ( ! notification.source().instance().map(declaredInstances::contains).orElse(false)) + controller.notificationsDb().removeNotifications(notification.source()); + if ( ! notification.source().zoneId().map(application.get().require(notification.source().instance().get()).deployments()::containsKey).orElse(false)) + controller.notificationsDb().removeNotifications(notification.source()); + } store(application); return application; |