Move CBC proxy enable check

This change will make our development environments closer to production
even if they aren't hooked up to the CBC proxy lambda functions.

Now in development, we will create the broadcast event and create tasks
for each broadcast provider event. We will still not create actual
broadcast provider message rows in the DB and talk to the CBC proxies.

This should be helpful in development to catch any issues we introduce
to do with sending broadcast messaging. In time we may wish to have some
fake CBC proxies in the AWS tools account that we can interact with to
make it even more realistic.
This commit is contained in:
David McDonald
2021-04-12 15:17:59 +01:00
parent 514afeb6f3
commit 295162c81d
2 changed files with 23 additions and 17 deletions

View File

@@ -106,10 +106,6 @@ def check_provider_message_should_send(broadcast_event, provider):
@notify_celery.task(name="send-broadcast-event")
@statsd(namespace="tasks")
def send_broadcast_event(broadcast_event_id):
if not current_app.config['CBC_PROXY_ENABLED']:
current_app.logger.info(f'CBC Proxy disabled, not sending broadcast_event {broadcast_event_id}')
return
broadcast_event = dao_get_broadcast_event_by_id(broadcast_event_id)
if (
@@ -149,6 +145,13 @@ def send_broadcast_event(broadcast_event_id):
@notify_celery.task(bind=True, name="send-broadcast-provider-message", max_retries=None)
@statsd(namespace="tasks")
def send_broadcast_provider_message(self, broadcast_event_id, provider):
if not current_app.config['CBC_PROXY_ENABLED']:
current_app.logger.info(
"CBC Proxy disabled, not sending broadcast_provider_message for "
f"broadcast_event_id {broadcast_event_id} with provider {provider}"
)
return
broadcast_event = dao_get_broadcast_event_by_id(broadcast_event_id)
check_provider_message_should_send(broadcast_event, provider)