gate: worker flush after plugin activation to detect swallowed RLS errors
This commit is contained in:
+3
-1
@@ -147,10 +147,12 @@ async def on_startup(ctx: dict[str, Any]) -> None:
|
|||||||
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:
|
||||||
# RLS may block duplicate cron job inserts — rollback and continue
|
# RLS may block duplicate cron job inserts — rollback and continue
|
||||||
# The cron jobs are already registered from the API container startup
|
# The cron jobs are already registered from the API container startup
|
||||||
logger.warning(f"Worker: plugin {name} activation failed for tenant {tenant_id}: {exc}")
|
logger.warning(f"Worker: plugin {name} activation issue for tenant {tenant_id}: {exc}")
|
||||||
await db.rollback()
|
await db.rollback()
|
||||||
activation_failed = True
|
activation_failed = True
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user