From cdb43fbaf6f9c1164017cdfc7a221c81678382bc Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 9 Nov 2021 15:41:14 +0000 Subject: [PATCH] Only loop timeout task if there's more work Previously this would repeat the task even the current iteration of the loop had processed a non-full batch. This could cause the task to error incorrectly if one or two notifications breach the timeout threshold in between iterations. --- app/celery/nightly_tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/celery/nightly_tasks.py b/app/celery/nightly_tasks.py index c6ef22c71..beb484f89 100644 --- a/app/celery/nightly_tasks.py +++ b/app/celery/nightly_tasks.py @@ -155,7 +155,7 @@ def timeout_notifications(): len(technical_failure_notifications), [str(x.id) for x in technical_failure_notifications]) raise NotificationTechnicalFailureException(message) - if len(notifications) == 0: + if len(notifications) < 100000: return raise RuntimeError("Some notifications may still be in sending.")