gate: db.expunge_all() after rollback to clear pending objects from failed INSERTs

This commit is contained in:
Agent Zero
2026-07-31 09:41:32 +02:00
parent d114fd7d4c
commit ab8d878bc7
+2
View File
@@ -233,10 +233,12 @@ async def lifespan(app: FastAPI):
except Exception as exc:
logger.warning(f"[STARTUP] Plugin {name} activation issue for tenant {tenant_id}: {exc}")
await db.rollback()
db.expunge_all() # Clear pending objects from failed INSERT
break
except Exception as exc:
logger.warning(f"[STARTUP] Plugin {name} activation failed: {exc}")
await db.rollback()
db.expunge_all()
plugin_record.status = "active"
logger.info(f"[STARTUP] Activated plugin: {name}")