rename callback_tasks.py to process_ses_receipts.py

create service_callback_tasks.py for tasks to send delivery statuses to services
This commit is contained in:
venusbb
2017-12-01 16:15:21 +00:00
parent 988b22391b
commit 489f43a2c9
7 changed files with 290 additions and 235 deletions

View File

@@ -0,0 +1,18 @@
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)