From 66a9778995d76796e342b24629c5448e3f4db335 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 18 Jul 2022 21:35:02 +0200 Subject: [PATCH] Fix incoming activity processing --- app/actor.py | 3 ++- app/incoming_activities.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/actor.py b/app/actor.py index 7b6803a..a270801 100644 --- a/app/actor.py +++ b/app/actor.py @@ -145,7 +145,8 @@ async def save_actor(db_session: AsyncSession, ap_actor: ap.RawObject) -> "Actor handle=_handle(ap_actor), ) db_session.add(actor) - await db_session.commit() + await db_session.flush() + await db_session.refresh(actor) return actor diff --git a/app/incoming_activities.py b/app/incoming_activities.py index 21dbabd..749e82c 100644 --- a/app/incoming_activities.py +++ b/app/incoming_activities.py @@ -108,6 +108,7 @@ async def process_next_incoming_activity(db_session: AsyncSession) -> bool: ) except Exception: logger.exception("Failed") + await db_session.rollback() next_activity.error = traceback.format_exc() _set_next_try(next_activity) else: