mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
Trigger task to publish alerts when sending or cancelling alert
When we send or cancel a broadcast message, we now trigger a task in govuk-alerts repo that polls our API for alerts and publishes a fresh list of alerts. Co-authored-by: Pea Tyczynska <pea.tyczynska@digital.cabinet-office.gov.uk>
This commit is contained in:
@@ -7,7 +7,7 @@ from notifications_utils.clients.zendesk.zendesk_client import (
|
||||
|
||||
from app import cbc_proxy_client, notify_celery, zendesk_client
|
||||
from app.clients.cbc_proxy import CBCProxyRetryableException
|
||||
from app.config import QueueNames
|
||||
from app.config import QueueNames, TaskNames
|
||||
from app.dao.broadcast_message_dao import (
|
||||
create_broadcast_provider_message,
|
||||
dao_get_broadcast_event_by_id,
|
||||
@@ -157,6 +157,11 @@ def send_broadcast_event(broadcast_event_id):
|
||||
zendesk_client.send_ticket_to_zendesk(ticket)
|
||||
current_app.logger.error(message)
|
||||
|
||||
notify_celery.send_task(
|
||||
name=TaskNames.PUBLISH_GOVUK_ALERTS,
|
||||
queue=QueueNames.GOVUK_ALERTS
|
||||
)
|
||||
|
||||
for provider in broadcast_event.service.get_available_broadcast_providers():
|
||||
send_broadcast_provider_message.apply_async(
|
||||
kwargs={'broadcast_event_id': broadcast_event_id, 'provider': provider},
|
||||
|
||||
Reference in New Issue
Block a user