From 538af6495589d7ca5ad78be08a96f073484ce7ca Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 19 Aug 2022 19:36:23 +0200 Subject: [PATCH] Fix inbox processing for deleted actors --- app/boxes.py | 1 + app/prune.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/boxes.py b/app/boxes.py index af63b47..cac6b49 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -1737,6 +1737,7 @@ async def save_to_inbox( actor = await fetch_actor(db_session, ap.get_id(raw_object["actor"])) except ap.ObjectNotFoundError: logger.warning("Actor not found") + return except httpx.HTTPStatusError: logger.exception("Failed to fetch actor") return diff --git a/app/prune.py b/app/prune.py index e683bd5..6cb25ac 100644 --- a/app/prune.py +++ b/app/prune.py @@ -25,6 +25,8 @@ async def prune_old_data( await _prune_old_outgoing_activities(db_session) await _prune_old_inbox_objects(db_session) + # TODO: delete actor with no remaining inbox objects + await db_session.commit() # Reclaim disk space await db_session.execute("VACUUM") # type: ignore @@ -110,5 +112,6 @@ async def _prune_old_inbox_objects( async def run_prune_old_data() -> None: + """CLI entrypoint.""" async with async_session() as db_session: await prune_old_data(db_session)