diff --git a/app/cli.py b/app/cli.py index d6f90d9e..a1f1ec19 100644 --- a/app/cli.py +++ b/app/cli.py @@ -307,6 +307,12 @@ def register(app): account.bounces += 1 db.session.commit() + @app.cli.command("clean_up_old_activities") + def clean_up_old_activities(): + with app.app_context(): + db.session.query(ActivityPubLog).filter(ActivityPubLog.created_at < utcnow() - timedelta(days=3)).delete() + db.session.commit() + def parse_communities(interests_source, segment): lines = interests_source.split("\n") diff --git a/email_notifs.sh b/email_notifs.sh index c70e21bb..9c22894f 100755 --- a/email_notifs.sh +++ b/email_notifs.sh @@ -4,3 +4,4 @@ source venv/bin/activate export FLASK_APP=pyfedi.py flask send_missed_notifs flask process_email_bounces +flask clean_up_old_activities