auto clean up old activity log entries

This commit is contained in:
rimu 2024-03-04 21:40:07 +13:00
parent 2ee8b4e1b3
commit 6ea0692bc1
2 changed files with 7 additions and 0 deletions

View file

@ -307,6 +307,12 @@ def register(app):
account.bounces += 1 account.bounces += 1
db.session.commit() 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): def parse_communities(interests_source, segment):
lines = interests_source.split("\n") lines = interests_source.split("\n")

View file

@ -4,3 +4,4 @@ source venv/bin/activate
export FLASK_APP=pyfedi.py export FLASK_APP=pyfedi.py
flask send_missed_notifs flask send_missed_notifs
flask process_email_bounces flask process_email_bounces
flask clean_up_old_activities