mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Allow retry exception to propagate from ses callback task
Celery `self.retry` raises an exception to communicate that the task needs to be retried. Since our ses task is wrapped in a catch-all except block it logs that exception as an error before retrying. Handling Retry class separately allows us to raise it without logging the traceback.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import iso8601
|
import iso8601
|
||||||
|
from celery.exceptions import Retry
|
||||||
from flask import current_app, json
|
from flask import current_app, json
|
||||||
from notifications_utils.statsd_decorators import statsd
|
from notifications_utils.statsd_decorators import statsd
|
||||||
from sqlalchemy.orm.exc import NoResultFound
|
from sqlalchemy.orm.exc import NoResultFound
|
||||||
@@ -75,6 +76,9 @@ def process_ses_results(self, response):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
except Retry:
|
||||||
|
raise
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.exception('Error processing SES results: {}'.format(type(e)))
|
current_app.logger.exception('Error processing SES results: {}'.format(type(e)))
|
||||||
self.retry(queue=QueueNames.RETRY)
|
self.retry(queue=QueueNames.RETRY)
|
||||||
|
|||||||
Reference in New Issue
Block a user