Files
notifications-api/app/celery/callback_tasks.py
Leo Hemsted b6ac7f074d celery.task.retry exc param should be a throwable.
This causes an issue when it hits the max retry limit, and tries to
throw your exception to let you deal with it - at this point it was
moaning because we pass in a string

if it's not defined, and we're inside an exception block celery uses
that instead.
2017-11-27 14:55:29 +00:00

19 lines
644 B
Python

from flask import current_app
from app import notify_celery
from app.config import QueueNames
from app.statsd_decorators import statsd
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)