Tweak tasks

This commit is contained in:
Thomas Sileo 2019-04-08 16:54:07 +02:00
parent 27622813ec
commit 12faea3c29
2 changed files with 9 additions and 1 deletions

8
app.py
View file

@ -1434,6 +1434,14 @@ def admin_cleanup2():
} }
) )
return "OK"
@app.route("/admin/cleanup3", methods=["GET"])
@login_required
def admin_cleanup3():
d = (datetime.utcnow() - timedelta(days=45)).strftime("%Y-%m-%d")
# Delete old replies we don't care about # Delete old replies we don't care about
DB.activities.delete_many( DB.activities.delete_many(
{"box": Box.REPLIES.value, "meta.keep": False, "activity.published": {"$lt": d}} {"box": Box.REPLIES.value, "meta.keep": False, "activity.published": {"$lt": d}}

2
run.sh
View file

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
python -c "import config; config.create_indexes()" python -c "import config; config.create_indexes()"
gunicorn -t 300 -w 5 -b 0.0.0.0:5005 --log-level debug app:app gunicorn -t 600 -w 5 -b 0.0.0.0:5005 --log-level debug app:app