Fix inbox processing for deleted actors

main
Thomas Sileo 2022-08-19 19:36:23 +02:00
parent f31f4e9d22
commit 538af64955
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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)