From 7c5674c4e1847620d0abd1fb6c8bba115b88ff05 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 29 Jan 2024 13:17:50 -0800 Subject: [PATCH] notify-admin-1137 make sure one-off files get written to db --- app/main/views/send.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 91e9814af..4332c7ddb 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -880,14 +880,20 @@ def send_notification(service_id, template_id): service_id, job_id=upload_id, include_one_off=True ) attempts = 0 - while notifications["total"] == 0 and attempts < 5: + + # The response can come back in different forms of incompleteness + while ( + notifications["total"] == 0 + and notifications["notifications"] == [] + and attempts < 50 + ): notifications = notification_api_client.get_notifications_for_service( service_id, job_id=upload_id, include_one_off=True ) time.sleep(0.1) attempts = attempts + 1 - if notifications["total"] == 0 and attempts == 5: + if notifications["total"] == 0 and attempts == 50: # This shows the job we auto-generated for the user return redirect( url_for(