Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5YFRisPHrLBR2dRu9
21 lines
917 B
Plaintext
21 lines
917 B
Plaintext
NaiveInventory: two users request seat C5 at the same moment (barrier forces both reads before either write)
|
|
====================================================================================================
|
|
|
|
holds granted for C5: 2 (a seat can only be sold once)
|
|
both users now pay:
|
|
outcomes (sorted): [CONFIRMED, HOLD_LOST_AFTER_PAYMENT]
|
|
customers charged: 2
|
|
customers refunded: 1
|
|
C5 in the end: BOOKED by BK-000x v3
|
|
|
|
Neither thread did anything unusual. Each ran check, then act, and the barrier only decided
|
|
that both checks finished before either act began.
|
|
|
|
PessimisticInventory, same two users at the same moment:
|
|
holds granted for C5: 1
|
|
loser sees: SeatUnavailableException
|
|
|
|
OptimisticInventory, same two users at the same moment:
|
|
holds granted for C5: 1
|
|
loser sees: SeatUnavailableException
|