1 / 2
Exactly one grey sofa
June made the shop text everyone waiting the moment the grey sofa came back in stock. One returned sofa then sold to nine thousand people at once.
The mistake
The back-in-stock alert texts all 9,204 waiting customers at the same moment. The checkout reads the stock level and creates the order in two separate steps, with no lock and no atomic decrement between them, so every concurrent checkout sees stock = 1 and every one of them succeeds. The cancel handler then adds one unit back to stock for each cancelled order, even though those orders never removed any. That pushes the count up to 9,203, which fires the back-in-stock alert again.
- ecommerce
- stock
- notifications
- release
- management