mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
only catch s3 and db errors in build-dvla-file-for-job
this reduces the amount of error messages we log (we'll no longer log at error level when build-dvla-file-for-job retries while waiting for the task to finish), and make sure we retry in those cases above - db or s3 having temporary troubl
This commit is contained in:
@@ -18,6 +18,8 @@ from requests import (
|
||||
RequestException
|
||||
)
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from botocore.exceptions import ClientError as BotoClientError
|
||||
|
||||
from app import (
|
||||
create_uuid,
|
||||
create_random_identifier,
|
||||
@@ -325,11 +327,11 @@ def build_dvla_file(self, job_id):
|
||||
else:
|
||||
msg = "All notifications for job {} are not persisted".format(job_id)
|
||||
current_app.logger.info(msg)
|
||||
self.retry(queue=QueueNames.RETRY, exc=Exception(msg))
|
||||
except Exception as e:
|
||||
# ? should this retry?
|
||||
self.retry(queue=QueueNames.RETRY)
|
||||
# specifically don't catch celery.retry errors
|
||||
except (SQLAlchemyError, BotoClientError):
|
||||
current_app.logger.exception("build_dvla_file threw exception")
|
||||
raise e
|
||||
self.retry(queue=QueueNames.RETRY)
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name='update-letter-job-to-sent')
|
||||
|
||||
Reference in New Issue
Block a user