gate: API startup resilient to RLS errors, dont fail on duplicate cron job inserts
This commit is contained in:
+4
-1
@@ -230,9 +230,12 @@ async def lifespan(app: FastAPI):
|
|||||||
# Flush to detect any RLS errors that were swallowed by the plugin
|
# Flush to detect any RLS errors that were swallowed by the plugin
|
||||||
await db.flush()
|
await db.flush()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
# RLS may block duplicate cron job inserts — rollback and continue
|
||||||
|
# The cron jobs are already registered from previous startups
|
||||||
logger.warning(f"[STARTUP] Plugin {name} activation issue for tenant {tenant_id}: {exc}")
|
logger.warning(f"[STARTUP] Plugin {name} activation issue for tenant {tenant_id}: {exc}")
|
||||||
await db.rollback()
|
await db.rollback()
|
||||||
activation_failed = True
|
# Don't set activation_failed — the plugin's event handlers are still registered
|
||||||
|
# and the cron jobs already exist in the DB from previous startups
|
||||||
break
|
break
|
||||||
|
|
||||||
if not activation_failed:
|
if not activation_failed:
|
||||||
|
|||||||
Reference in New Issue
Block a user