From 390acb66e02bf2755027d4f476a3d95bd6d3038f Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 29 Jul 2022 15:12:56 -0400 Subject: [PATCH] cron.py: fix missing import, preserve /h/changelog. Multiple closely related issues: - When sub_inactive_purge_task was moved to cron.py, a number of imports were not added. Notably, missing helpers/alerts.py. This led to hole inactivity deletions not taking place. - However, this proved useful: the hole it's been trying to delete the past few days was /h/changelog. This has now been excluded from deletion. - Finally, the missing import would've meant the monthly procoins disbursement would fail when it runs in a couple days. This has likewise been fixed. --- files/helpers/cron.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 9282cc716..79574a794 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -1,6 +1,7 @@ from files.cli import g, app, db_session import click from files.helpers.const import * +from files.helpers.alerts import send_repeatable_notification from files.classes import * import files.helpers.lottery as lottery @@ -48,6 +49,7 @@ def sub_inactive_purge_task(): one_week_ago = time.time() - 604800 active_holes = [x[0] for x in g.db.query(Submission.sub).distinct() \ .filter(Submission.sub != None, Submission.created_utc > one_week_ago).all()] + active_holes.append('changelog') # system hole immune from deletion dead_holes = g.db.query(Sub).filter(Sub.name.notin_(active_holes)).all() names = [x.name for x in dead_holes]