Rejected Gate Request Releases an Occupied Slot
Level 2 · node · Concurrency · Semaphore permit released after failed acquisition
Scenario
A fictional interactive venue limits concurrent visitors to two. Each admitted request occupies a slot until it exits. A rejected request still releases a slot during cleanup. This allows a third visitor to enter while two admitted visitors remain inside.
Requirements
Only successfully admitted requests may return a slot. A rejected request must never change the active visitor count. Returning the same ticket twice must not release multiple slots, and active occupancy must never exceed the limit of two.
Acceptance criteria
- Two admitted visitors occupy both slots.
- Cleanup of a rejected request does not reduce occupancy.
- Additional entry remains denied after rejected-request cleanup.
- Returning a valid ticket frees exactly one slot.