forked from forks/microblog.pub
Tweak gridfs cleanup task
This commit is contained in:
parent
12faea3c29
commit
849a6c4ea0
1 changed files with 8 additions and 2 deletions
6
app.py
6
app.py
|
@ -1422,7 +1422,10 @@ def admin_cleanup2():
|
||||||
):
|
):
|
||||||
# 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"]}):
|
||||||
|
try:
|
||||||
MEDIA_CACHE.fs.delete(grid_item._id)
|
MEDIA_CACHE.fs.delete(grid_item._id)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
# Delete the Create activities that no longer have cached attachments
|
# Delete the Create activities that no longer have cached attachments
|
||||||
DB.activities.delete_many(
|
DB.activities.delete_many(
|
||||||
|
@ -1451,7 +1454,10 @@ def admin_cleanup3():
|
||||||
for grid_item in MEDIA_CACHE.fs.find(
|
for grid_item in MEDIA_CACHE.fs.find(
|
||||||
{"kind": {"$in": ["og", "attachment"]}, "remote_id": {"$exists": False}}
|
{"kind": {"$in": ["og", "attachment"]}, "remote_id": {"$exists": False}}
|
||||||
):
|
):
|
||||||
|
try:
|
||||||
MEDIA_CACHE.fs.delete(grid_item._id)
|
MEDIA_CACHE.fs.delete(grid_item._id)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
# TODO(tsileo): iterator over "actor_icon" and look for unused one in a separate task
|
# TODO(tsileo): iterator over "actor_icon" and look for unused one in a separate task
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue