Files
notifications-api/app/celery/process_ses_receipts_tasks.py
Richard Chapman d855b4e4ec Removed statsd from the api and use the statsd in the utils library.
The statsd code was added to the utils library a while ago, uses the
statsd from the util library and therefore consolidates the code into
once place.
2018-02-06 09:52:15 +00:00

20 lines
661 B
Python

from flask import current_app
from notifications_utils.statsd_decorators import statsd
from app import notify_celery
from app.config import QueueNames
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)
except Exception as exc:
current_app.logger.exception('Error processing SES results')
self.retry(queue=QueueNames.RETRY)