From f8fbaba77db4736346e5d076bdfde2d07fbc4a71 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Fri, 23 Oct 2020 14:51:10 +0100 Subject: [PATCH] limit collate task to 50,000 messages we've seen issues where tasks mysteriously hang and do not process large volumes of letters - in this case >150k letters in created state. to try and get at least some letters out of the door, limit the query to only return 50k letters per postage type. We may need to run the task multiple times, or letters may get delayed until the next day when they'd be picked up (provided there's enough capacity then). The task should only be re-run AFTER the ftp tasks have all finished, and updated the letters to sending, or we run the risk of sending the same letters twice. For context, the largest ever letter day we've sent is ~65k in march of this year. --- app/dao/notifications_dao.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index cf9f143d4..7c8564489 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -730,7 +730,7 @@ def dao_get_letters_to_be_printed(print_run_deadline, postage): ).order_by( Notification.service_id, Notification.created_at - ) + ).limit(50000) return notifications