Two bugs:
1) Drafts, deleted posts, and removed posts counted toward hole
aliveness. This has been fixed.
2) Foreign key constraints in sub_joins weren't getting deleted,
so stealth holes couldn't be deleted.
Both of these conspired to keep /h/smuggies alive, so they must be
fixed.
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.
Also: change to docker-compose.yml is to see if it'll fix the Github
tests failing. Lumped in here because it's too dumb to make a commit
for by itself.
Prior to this comment, the every-1d cron.py command was broken due
to lack of proper stats import. However, while refactoring this, it
was convenient to move other recurring tasks that had been stuffed in
odd places--not least `stats(...)`--into the new cron system. This
entailed a number of refactorings of other things.
1. Move stats(...) from static.py to helpers/stats.py.
2. Move hole inactivity purge task from stats(...) to routes/subs.py.
3. Move bot award timer checks from stats(...) to helpers/awards.py.
4. Unify award timer logic formerly in routes/front.py into the new
helpers/awards.py.
The reddit mentions system contained much duplicated code and was
grafted onto the post thumbnail pipeline to achieve semi-regular
invocation. Instead, we now run it through the new cron system,
and the duplicate code has been refactored out.
Adding an empty __init__.py, the imports-only cli.py, and setting
FLASK_APP in the environment are enough to get the `flask` command
to work. This will enable future changes, including database
migrations.
The proximate reason for the fix is to add a `flask cron` command
to run scheduled tasks within the application from cron. Specifically,
the lottery should be run from cron.