2017-11-17 13:41:45 +00:00
|
|
|
from flask import current_app
|
2018-02-06 09:35:33 +00:00
|
|
|
from notifications_utils.statsd_decorators import statsd
|
2017-11-17 13:41:45 +00:00
|
|
|
|
|
|
|
|
from app import notify_celery
|
|
|
|
|
from app.config import QueueNames
|
2018-02-06 09:35:33 +00:00
|
|
|
|
2017-11-17 13:41:45 +00:00
|
|
|
from app.notifications.notifications_ses_callback import process_ses_response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@notify_celery.task(bind=True, name="process-ses-result", max_retries=5, default_retry_delay=300)
|
|
|
|
|
@statsd(namespace="tasks")
|
|
|
|
|
def process_ses_results(self, response):
|
|
|
|
|
try:
|
|
|
|
|
errors = process_ses_response(response)
|
|
|
|
|
if errors:
|
|
|
|
|
current_app.logger.error(errors)
|
2018-11-07 13:39:08 +00:00
|
|
|
except Exception:
|
2017-11-17 13:41:45 +00:00
|
|
|
current_app.logger.exception('Error processing SES results')
|
2017-11-23 13:49:52 +00:00
|
|
|
self.retry(queue=QueueNames.RETRY)
|