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.
This commit is contained in:
Ben Thorner
2021-11-09 15:41:14 +00:00
parent 77c8c0a501
commit cdb43fbaf6

View File

@@ -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.")