mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
update research mode email callbacks to add process-ses-response task to queue
this involved: * moving that task to callback_tasks to prevent circular imports * updating the dummy research mode callbacks (with actual SNS messages from the ses simulator emails) * refactoring tests
This commit is contained in:
18
app/celery/callback_tasks.py
Normal file
18
app/celery/callback_tasks.py
Normal 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:
|
||||
current_app.logger.exception('Error processing SES results')
|
||||
self.retry(queue=QueueNames.RETRY, exc="SES responses processed with error")
|
||||
Reference in New Issue
Block a user