Add celery task to dispatch pending notifications

This commit is contained in:
davelopez
2024-04-16 17:06:18 +02:00
parent 8a62db2b29
commit a4e22b4f41
+8
View File
@@ -494,3 +494,11 @@ def send_notification_to_recipients_async(
_, notifications_sent = notification_manager.send_notification_to_recipients(request=request)
log.info(f"Successfully sent {notifications_sent} notifications.")
@galaxy_task(action="dispatch pending notifications")
def dispatch_pending_notifications(notification_manager: NotificationManager):
"""Dispatch pending notifications."""
count = notification_manager.dispatch_pending_notifications_via_channels()
if count:
log.info(f"Successfully dispatched {count} notifications.")