Files
outline/server/utils
Tom Moor aab83e8378 fix: Reliability of count-based limit checks (#13542)
* fix: Make count-based limit checks reliable under concurrency

Limits enforced by counting rows before an insert could be exceeded by
requests that ran at the same time, as each one read the same count
before any of them had written. Add a LockHelper that takes a Postgres
advisory lock for the remainder of the transaction, and use it to
serialize the check for webhook subscriptions, team domains, share
subscriptions and pins. The counts now also run on the transaction so
they include rows written earlier in the same request.

* Remove excessive tests

* Also guard simultaneous row removal
2026-08-24 19:14:55 -04:00
..