gate: db.expunge_all() after rollback to clear pending objects from failed INSERTs
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user