gate: API main.py flush+rollback after plugin activation for RLS error handling
This commit is contained in:
+4
-1
@@ -227,8 +227,11 @@ async def lifespan(app: FastAPI):
|
|||||||
try:
|
try:
|
||||||
await set_tenant_context(db, tenant_id)
|
await set_tenant_context(db, tenant_id)
|
||||||
await plugin.on_activate(db, container, event_bus)
|
await plugin.on_activate(db, container, event_bus)
|
||||||
|
# Flush to detect any RLS errors that were swallowed by the plugin
|
||||||
|
await db.flush()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error(f"[STARTUP] Failed to activate plugin {name} for tenant {tenant_id}: {exc}")
|
logger.warning(f"[STARTUP] Plugin {name} activation issue for tenant {tenant_id}: {exc}")
|
||||||
|
await db.rollback()
|
||||||
activation_failed = True
|
activation_failed = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user