From e265ee253b821d1f77b8c2854731594130b99ce2 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Thu, 19 Dec 2024 18:20:04 +0100 Subject: [PATCH] events: notification_cleanup: avoid unnecessary loop (#12417) --- authentik/events/tasks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/authentik/events/tasks.py b/authentik/events/tasks.py index 0989dc8b5d..d923b068b5 100644 --- a/authentik/events/tasks.py +++ b/authentik/events/tasks.py @@ -138,7 +138,6 @@ def notification_cleanup(self: SystemTask): """Cleanup seen notifications and notifications whose event expired.""" notifications = Notification.objects.filter(Q(event=None) | Q(seen=True)) amount = notifications.count() - for notification in notifications: - notification.delete() + notifications.delete() LOGGER.debug("Expired notifications", amount=amount) self.set_status(TaskStatus.SUCCESSFUL, f"Expired {amount} Notifications")