Skip to main content
Starter: 2 concurrent browser sessions. Pro: 10. Enterprise: 50.
Ledger enforces each plan’s concurrency limit, so a customer runs exactly as many sessions as they pay for, even when starts race. Concurrency is a held feature: a count of what the customer runs right now. Your app adds one when a session starts and removes one when it ends, and Ledger stops a start past the plan’s limit. A periodic count sets the number to what your own session table says, so a slot held by a worker that crashed before its remove comes back on the next sync.

The catalog

The calls

A session starts: track quantity: 1 before you open it. The track is the gate: Ledger decides it in one transaction per customer, so of two starts racing for the last slot, exactly one wins. A 409 limit_reached means every slot is in use.
Response
To show “3 of 10 free” before the customer clicks, check with quantity: 1; it holds nothing, so the track still decides. A session ends: track quantity: -1 with the session’s own end ID. A retried end counts once, and an end at 0 applies nothing.
Every minute: set the true count. Count the customer’s live sessions in your own table, where a crashed worker’s session has timed out, and send it as count. Ledger sets the held number to it outright, and chargedQuantity is the difference it applied. Give each sync its own request_id.
A worker that died holding a slot left used at 7 while 6 sessions run; the sync answers chargedQuantity: -1 and used: 6, and the slot is free again.

Rules

  • Your session table is the truth. count applies even above the limit, since it reports what runs. A customer over the limit after a downgrade keeps their sessions, and new starts resume once the count is under it.
  • Sync on a short interval. A slot lost to a crash is reclaimed on the next sync, so the interval is the longest a customer waits for it. A start tracked between your table read and the sync’s track is corrected by the sync after.
  • Send either quantity or count. count sets held features, and a held track’s quantity is non-zero.
  • With fail open on, a start during a Ledger outage or timeout is allowed and its track is queued; the next sync sets the true count.
  • The start’s track is the hold. Held features take tracks; a reserve on one answers 400 reserve_not_supported.
  • The count carries across billing periods and plan changes (Limits).