mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Fix GC
This commit is contained in:
parent
1061b13029
commit
5cfbab53c4
1 changed files with 9 additions and 5 deletions
14
core/gc.py
14
core/gc.py
|
@ -16,6 +16,10 @@ from config import ME
|
||||||
from config import MEDIA_CACHE
|
from config import MEDIA_CACHE
|
||||||
from core import activitypub
|
from core import activitypub
|
||||||
from core.meta import Box
|
from core.meta import Box
|
||||||
|
from core.meta import MetaKey
|
||||||
|
from core.meta import _meta
|
||||||
|
from core.meta import by_type
|
||||||
|
from core.meta import in_inbox
|
||||||
from utils.migrations import DB
|
from utils.migrations import DB
|
||||||
|
|
||||||
back = activitypub.MicroblogPubBackend()
|
back = activitypub.MicroblogPubBackend()
|
||||||
|
@ -62,9 +66,9 @@ def perform() -> None: # noqa: C901
|
||||||
|
|
||||||
delete_deleted = DB.activities.delete_many(
|
delete_deleted = DB.activities.delete_many(
|
||||||
{
|
{
|
||||||
"box": Box.INBOX.value,
|
**in_inbox(),
|
||||||
"type": ap.ActivityType.DELETE.value,
|
**by_type(ap.ActivityType.DELETE),
|
||||||
"activity.published": {"$lt": d},
|
_meta(MetaKey.PUBLISHED): {"$lt": d},
|
||||||
}
|
}
|
||||||
).deleted_count
|
).deleted_count
|
||||||
logger.info(f"{delete_deleted} Delete deleted")
|
logger.info(f"{delete_deleted} Delete deleted")
|
||||||
|
@ -76,7 +80,7 @@ def perform() -> None: # noqa: C901
|
||||||
{
|
{
|
||||||
"box": Box.INBOX.value,
|
"box": Box.INBOX.value,
|
||||||
"type": ap.ActivityType.CREATE.value,
|
"type": ap.ActivityType.CREATE.value,
|
||||||
"activity.published": {"$lt": d},
|
_meta(MetaKey.PUBLISHED): {"$lt": d},
|
||||||
"meta.gc_keep": {"$exists": False},
|
"meta.gc_keep": {"$exists": False},
|
||||||
}
|
}
|
||||||
).limit(500):
|
).limit(500):
|
||||||
|
@ -157,7 +161,7 @@ def perform() -> None: # noqa: C901
|
||||||
{
|
{
|
||||||
"box": Box.INBOX.value,
|
"box": Box.INBOX.value,
|
||||||
"type": ap.ActivityType.ANNOUNCE.value,
|
"type": ap.ActivityType.ANNOUNCE.value,
|
||||||
"activity.published": {"$lt": d},
|
_meta(MetaKey.PUBLISHED): {"$lt": d},
|
||||||
"meta.gc_keep": {"$exists": False},
|
"meta.gc_keep": {"$exists": False},
|
||||||
}
|
}
|
||||||
).limit(500):
|
).limit(500):
|
||||||
|
|
Loading…
Reference in a new issue