increase reply to address validation timeout on preview

Celery/SQS underperforms in low-traffic environments. Tasks will sit on
celery queues for several seconds before getting picked up if they're
the only thing on the queue. This is observable in our test environments
like preview and staging, but we've got enough load on production that
this isn't an issue.

When we validate reply to email addresses, we expect a delivery receipt
to have been processed within 45 seconds of the button being pressed. On
preview, we often observe times over that, possibly due to the several
queues involved in sending an email and processing its receipt. So, to
ensure that functional tests can pass (when we don't really care how
fast things are, just that the flow doesn't break), bump this timeout up
to 120 seconds on preview. The functional tests were waiting for 120
seconds for the reply to address to be validated anyway.
This commit is contained in:
Leo Hemsted
2020-01-07 11:57:38 +00:00
parent 91adadfed0
commit e5b2d81d22
2 changed files with 7 additions and 1 deletions

View File

@@ -72,6 +72,8 @@ class Config(object):
ACTIVITY_STATS_LIMIT_DAYS = 7
TEST_MESSAGE_FILENAME = 'Report'
REPLY_TO_EMAIL_ADDRESS_VALIDATION_TIMEOUT = 45
NOTIFY_ENVIRONMENT = 'development'
LOGO_UPLOAD_BUCKET_NAME = 'public-logos-local'
MOU_BUCKET_NAME = 'local-mou'
@@ -147,6 +149,9 @@ class Preview(Config):
ASSET_DOMAIN = 'static.notify.works'
ASSET_PATH = 'https://static.notify.works/'
# On preview, extend the validation timeout to allow more leniency when running functional tests
REPLY_TO_EMAIL_ADDRESS_VALIDATION_TIMEOUT = 120
class Staging(Config):
SHOW_STYLEGUIDE = False

View File

@@ -478,7 +478,8 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
created_at_no_tz = notification["created_at"][:-6]
seconds_since_sending = (datetime.utcnow() - datetime.strptime(created_at_no_tz, '%Y-%m-%dT%H:%M:%S.%f')).seconds
if notification["status"] in FAILURE_STATUSES or (
notification["status"] in SENDING_STATUSES and seconds_since_sending > 45
notification["status"] in SENDING_STATUSES and
seconds_since_sending > current_app.config['REPLY_TO_EMAIL_ADDRESS_VALIDATION_TIMEOUT']
):
verification_status = "failure"
form.email_address.data = notification['to']