events: notification_cleanup: avoid unnecessary loop (#12417) Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							15cb6b18f6
						
					
				
				
					commit
					ac25fbab54
				
			@ -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")
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user