From 84381e9635bdaf913d8101620198cfbbdfd5270d Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Fri, 12 Jun 2020 23:50:21 +0200 Subject: [PATCH] reduce memory use in cron by using yield_per() --- cron.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cron.py b/cron.py index 1810bbdf..339e9075 100644 --- a/cron.py +++ b/cron.py @@ -179,7 +179,7 @@ def stats_before(moment: Arrow) -> Stats: q = q.filter(~User.email.contains(ie)) nb_spam = nb_bounced = nb_forward = nb_block = nb_reply = 0 - for email_log in q: + for email_log in q.yield_per(500): if email_log.bounced: nb_bounced += 1 elif email_log.is_spam: