From dd50db40d98fd58bf2730679830a933a408c9b5c Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Thu, 14 Jul 2022 09:23:11 +0200 Subject: [PATCH] Tweak incoming activity processing --- app/incoming_activities.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/incoming_activities.py b/app/incoming_activities.py index a73284a..f29e348 100644 --- a/app/incoming_activities.py +++ b/app/incoming_activities.py @@ -81,11 +81,12 @@ async def process_next_incoming_activity(db_session: AsyncSession) -> bool: next_activity.last_try = now() try: - await save_to_inbox( - db_session, - next_activity.ap_object, - next_activity.sent_by_ap_actor_id, - ) + async with db_session.begin_nested(): + await save_to_inbox( + db_session, + next_activity.ap_object, + next_activity.sent_by_ap_actor_id, + ) except Exception: logger.exception("Failed") next_activity.error = traceback.format_exc()