f57127444f0e6faac387844575ceefa5aab61f44
The order-placement stock check (read available qty, then insert an "out" deduction) had no row lock, so two concurrent orders for the same product could both pass the availability check before either committed its deduction, overselling the item. Locks each ordered product's productlocations row with SELECT ... FOR UPDATE up front, in a fixed (productid, locationid) order across all items so overlapping concurrent orders contend for locks in the same sequence instead of deadlocking.
Description
No description provided
Languages
Go
99.2%
JavaScript
0.7%