mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Merge branch 'master' into use-reply-to-in-send-to-provider
This commit is contained in:
@@ -13,6 +13,6 @@ def process_ses_results(self, response):
|
||||
errors = process_ses_response(response)
|
||||
if errors:
|
||||
current_app.logger.error(errors)
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
current_app.logger.exception('Error processing SES results')
|
||||
self.retry(queue=QueueNames.RETRY, exc="SES responses processed with error")
|
||||
self.retry(queue=QueueNames.RETRY)
|
||||
|
||||
@@ -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,
|
||||
@@ -326,12 +328,13 @@ def build_dvla_file(self, job_id):
|
||||
)
|
||||
dao_update_job_status(job_id, JOB_STATUS_READY_TO_SEND)
|
||||
else:
|
||||
current_app.logger.info("All notifications for job {} are not persisted".format(job_id))
|
||||
self.retry(queue=QueueNames.RETRY, exc="All notifications for job {} are not persisted".format(job_id))
|
||||
except Exception as e:
|
||||
# ? should this retry?
|
||||
msg = "All notifications for job {} are not persisted".format(job_id)
|
||||
current_app.logger.info(msg)
|
||||
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')
|
||||
@@ -523,9 +526,7 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
|
||||
)
|
||||
if not isinstance(e, HTTPError) or e.response.status_code >= 500:
|
||||
try:
|
||||
self.retry(queue=QueueNames.RETRY,
|
||||
exc='Unable to send_inbound_sms_to_service for service_id: {} and url: {}. \n{}'.format(
|
||||
service_id, inbound_api.url, e))
|
||||
self.retry(queue=QueueNames.RETRY)
|
||||
except self.MaxRetriesExceededError:
|
||||
current_app.logger.exception('Retry: send_inbound_sms_to_service has retried the max number of times')
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ from app.dao.service_sms_sender_dao import dao_get_service_sms_senders_by_id
|
||||
from app.notifications.validators import (
|
||||
check_service_over_daily_message_limit,
|
||||
validate_and_format_recipient,
|
||||
validate_template, check_service_sms_sender_id)
|
||||
validate_template
|
||||
)
|
||||
from app.notifications.process_notifications import (
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
@@ -15,7 +16,9 @@ from app.models import (
|
||||
KEY_TYPE_NORMAL,
|
||||
PRIORITY,
|
||||
SMS_TYPE,
|
||||
EMAIL_TYPE, LETTER_TYPE)
|
||||
EMAIL_TYPE,
|
||||
LETTER_TYPE
|
||||
)
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
from app.dao.templates_dao import dao_get_template_by_id_and_service_id
|
||||
from app.dao.users_dao import get_user_by_id
|
||||
|
||||
Reference in New Issue
Block a user