mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Merge pull request #1277 from GSA/more_backoff
improve exponential backoff while job hunting
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import itertools
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from botocore.exceptions import ClientError
|
||||
from flask import Blueprint, current_app, jsonify, request
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
@@ -503,37 +502,24 @@ def get_all_notifications_for_service(service_id):
|
||||
|
||||
for notification in pagination.items:
|
||||
if notification.job_id is not None:
|
||||
try:
|
||||
notification.personalisation = get_personalisation_from_s3(
|
||||
notification.service_id,
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
except ClientError as ex:
|
||||
if ex.response["Error"]["Code"] == "NoSuchKey":
|
||||
notification.personalisation = ""
|
||||
else:
|
||||
raise ex
|
||||
notification.personalisation = get_personalisation_from_s3(
|
||||
notification.service_id,
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
|
||||
try:
|
||||
recipient = get_phone_number_from_s3(
|
||||
notification.service_id,
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
recipient = get_phone_number_from_s3(
|
||||
notification.service_id,
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
|
||||
notification.to = recipient
|
||||
notification.normalised_to = recipient
|
||||
except ClientError as ex:
|
||||
if ex.response["Error"]["Code"] == "NoSuchKey":
|
||||
notification.to = ""
|
||||
notification.normalised_to = ""
|
||||
else:
|
||||
raise ex
|
||||
notification.to = recipient
|
||||
notification.normalised_to = recipient
|
||||
|
||||
else:
|
||||
notification.to = "1"
|
||||
notification.normalised_to = "1"
|
||||
notification.to = ""
|
||||
notification.normalised_to = ""
|
||||
|
||||
kwargs = request.args.to_dict()
|
||||
kwargs["service_id"] = service_id
|
||||
|
||||
Reference in New Issue
Block a user