mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Tweak cleanup tasks
This commit is contained in:
parent
686d614386
commit
cd8662f04d
1 changed files with 5 additions and 3 deletions
8
app.py
8
app.py
|
@ -1390,7 +1390,9 @@ def admin_new():
|
||||||
@login_required
|
@login_required
|
||||||
def admin_notifications():
|
def admin_notifications():
|
||||||
# Setup the cron for deleting old activities
|
# Setup the cron for deleting old activities
|
||||||
p.push({}, "/task/cleanup", schedule="@every 12h")
|
|
||||||
|
# FIXME(tsileo): put back to 12h
|
||||||
|
p.push({}, "/task/cleanup", schedule="@every 1h")
|
||||||
|
|
||||||
# Trigger a cleanup if asked
|
# Trigger a cleanup if asked
|
||||||
if request.args.get("cleanup"):
|
if request.args.get("cleanup"):
|
||||||
|
@ -2847,11 +2849,11 @@ def task_cleanup_part_2():
|
||||||
"meta.keep": False,
|
"meta.keep": False,
|
||||||
"activity.published": {"$lt": d},
|
"activity.published": {"$lt": d},
|
||||||
}
|
}
|
||||||
):
|
).limit(5000):
|
||||||
# Delete the cached attachment/
|
# Delete the cached attachment/
|
||||||
for grid_item in MEDIA_CACHE.fs.find({"remote_id": data["remote_id"]}):
|
for grid_item in MEDIA_CACHE.fs.find({"remote_id": data["remote_id"]}):
|
||||||
MEDIA_CACHE.fs.delete(grid_item._id)
|
MEDIA_CACHE.fs.delete(grid_item._id)
|
||||||
DB.activities.delete_one({"_id": data["_id"]})
|
DB.activities.delete_one({"_id": data["_id"]})
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue