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: trackquantity: 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
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.
count. Ledger sets the held number to it outright, and chargedQuantity is the difference it applied. Give each sync its own request_id.
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.
countapplies 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
quantityorcount.countsets held features, and a held track’squantityis 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
reserveon one answers400 reserve_not_supported. - The count carries across billing periods and plan changes (Limits).
Related
- Limits: held features, add, remove and
count. - Per-seat pricing: bill for a held count.
- Check and track: refusals and how to handle them.