Design, implement, and test race-safe NitroCine seat booking, expiring holds, payment confirmation, cancellation, and callback idempotency. Use for double-booking bugs, concurrency changes, seat inventory modeling, or booking/payment transaction reviews.
Scanned 9/12/2026
Install to Claude Code
npx -y skills add HoangDuc1003/Cinema-booking --skill booking-concurrency --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Booking Concurrency?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangduc1003-booking-concurrency)More formats (shields.io, HTML) on the badges page.
---
name: booking-concurrency
description: Design, implement, and test race-safe NitroCine seat booking, expiring holds, payment confirmation, cancellation, and callback idempotency. Use for double-booking bugs, concurrency changes, seat inventory modeling, or booking/payment transaction reviews.
---
# Harden Booking Concurrency
Maintain this invariant: at most one active reservation exists for a `(show, seat)` pair.
1. Normalize and validate seat IDs; reject duplicates and cap seats per booking.
2. Calculate price on the server from the show and seat class.
3. Resolve virtual shows before forming the final lock key.
4. Acquire a short show-level Redis lock to reduce contention.
5. Within a MongoDB transaction, remove reclaimable expired holds, insert unique seat reservations, and create the booking.
6. Map duplicate-key errors to HTTP 409. Keep the unique compound index as the final guard.
7. Store an explicit hold expiry. Do not let unpaid bookings hold inventory indefinitely.
8. On payment, idempotently mark the booking paid, confirm reservations, and materialize paid occupancy in the show.
9. On cancellation, atomically delete held reservations and the unpaid booking.
10. Invalidate the seat map and affected show caches only after a committed mutation.
Exercise identical-seat races, disjoint-seat concurrency, expired hold reuse, duplicate webhook delivery, cancellation, and Redis unavailability. MongoDB transactions require a replica set or Atlas; report this prerequisite clearly.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!