KamoCRM

Save answers before the rights fan-out, not after it

FixSecurityService
Shipped
October 14, 2026 at 1:30 PM UTC
Author
Kamo
Commit
75ada5f

Saving a security model (e.g. its Default Security Roles) re-seeded and recalculated member rights for every org using the model before it responded. A model shared by 44 child orgs took ~3.5 minutes at ~5 s per org. That outlived APIService's upstream timeout, so the browser showed "Failed to fetch", and each retry started another full fan-out alongside the first. The model's rows are committed before the fan-out starts, so the request now queues the fan-out on SecurityModelRecalcDispatcher (one background worker) and returns. Saves of a model whose fan-out is already queued or running fold into a single re-run.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing