aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2021-04-22 15:13:28 +0200
committerValerij Fredriksen <valerijf@verizonmedia.com>2021-04-22 15:13:28 +0200
commit358b04bf34a61f6af16a59c110e2ba0606d36ebb (patch)
treeb64e0979f8c223ef80630ffa4ab8b0752cebb1c0 /controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
parent3f231170ffb5cc3705651a4e3eb6317e0c8d1952 (diff)
Delete under lock and skip update part
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
index d470415f521..950dddfc056 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
@@ -67,10 +67,12 @@ public class NotificationsDb {
/** Remove all notifications for this source or sources contained by this source */
public void removeNotifications(NotificationSource source) {
- if (source.application().isEmpty()) // Source is tenant
- curatorDb.deleteNotifications(source.tenant());
-
try (Lock lock = curatorDb.lockNotifications(source.tenant())) {
+ if (source.application().isEmpty()) { // Source is tenant
+ curatorDb.deleteNotifications(source.tenant());
+ return;
+ }
+
List<Notification> initial = curatorDb.readNotifications(source.tenant());
List<Notification> filtered = initial.stream()
.filter(notification -> !source.contains(notification.source()))