forked from MarseyWorld/MarseyWorld
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.master
parent
dcb6a2f848
commit
390acb66e0
|
@ -1,6 +1,7 @@
|
||||||
from files.cli import g, app, db_session
|
from files.cli import g, app, db_session
|
||||||
import click
|
import click
|
||||||
from files.helpers.const import *
|
from files.helpers.const import *
|
||||||
|
from files.helpers.alerts import send_repeatable_notification
|
||||||
from files.classes import *
|
from files.classes import *
|
||||||
|
|
||||||
import files.helpers.lottery as lottery
|
import files.helpers.lottery as lottery
|
||||||
|
@ -48,6 +49,7 @@ def sub_inactive_purge_task():
|
||||||
one_week_ago = time.time() - 604800
|
one_week_ago = time.time() - 604800
|
||||||
active_holes = [x[0] for x in g.db.query(Submission.sub).distinct() \
|
active_holes = [x[0] for x in g.db.query(Submission.sub).distinct() \
|
||||||
.filter(Submission.sub != None, Submission.created_utc > one_week_ago).all()]
|
.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()
|
dead_holes = g.db.query(Sub).filter(Sub.name.notin_(active_holes)).all()
|
||||||
names = [x.name for x in dead_holes]
|
names = [x.name for x in dead_holes]
|
||||||
|
|
Loading…
Reference in New Issue