mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 05:04:27 +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 core import activitypub
|
||||
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
|
||||
|
||||
back = activitypub.MicroblogPubBackend()
|
||||
|
@ -62,9 +66,9 @@ def perform() -> None: # noqa: C901
|
|||
|
||||
delete_deleted = DB.activities.delete_many(
|
||||
{
|
||||
"box": Box.INBOX.value,
|
||||
"type": ap.ActivityType.DELETE.value,
|
||||
"activity.published": {"$lt": d},
|
||||
**in_inbox(),
|
||||
**by_type(ap.ActivityType.DELETE),
|
||||
_meta(MetaKey.PUBLISHED): {"$lt": d},
|
||||
}
|
||||
).deleted_count
|
||||
logger.info(f"{delete_deleted} Delete deleted")
|
||||
|
@ -76,7 +80,7 @@ def perform() -> None: # noqa: C901
|
|||
{
|
||||
"box": Box.INBOX.value,
|
||||
"type": ap.ActivityType.CREATE.value,
|
||||
"activity.published": {"$lt": d},
|
||||
_meta(MetaKey.PUBLISHED): {"$lt": d},
|
||||
"meta.gc_keep": {"$exists": False},
|
||||
}
|
||||
).limit(500):
|
||||
|
@ -157,7 +161,7 @@ def perform() -> None: # noqa: C901
|
|||
{
|
||||
"box": Box.INBOX.value,
|
||||
"type": ap.ActivityType.ANNOUNCE.value,
|
||||
"activity.published": {"$lt": d},
|
||||
_meta(MetaKey.PUBLISHED): {"$lt": d},
|
||||
"meta.gc_keep": {"$exists": False},
|
||||
}
|
||||
).limit(500):
|
||||
|
|
Loading…
Reference in a new issue