Flash sales: atomic inventory under contention

Three products with limited stock. Click Buy and watch the count tick down in real time. Server runs live.lock({ key: (ctx, id) => 'flash:product:' + id, maxWaitMs: 1500 }, ...) so concurrent buys on one product serialize FIFO and stock never goes negative. Spam the stress button to surface LOCK_TIMEOUT: queued waiters past the bound get rejected instead of holding the request indefinitely.

Shopping as Quirky Narwhal (20666169)

Coupon: SAVE20 (one per user)

Pool remaining: 50 / 50

loading...

Stress: spam buys at one product

Drives concurrent buys at the chosen product. Lock serializes them; bursts past maxWaitMs (1500ms) surface as LOCK_TIMEOUT. Per-buy artificial delay is 80ms.

Recent sales (0)

Nothing yet.