开发者

How to deal with inventory and concurrency

开发者 https://www.devze.com 2023-03-20 07:07 出处:网络
What are strategies to deal with seemingly common scenario of a limited inventory and an order form.

What are strategies to deal with seemingly common scenario of a limited inventory and an order form.

If there is one item left, and two people attempt to purchase at the same t开发者_运维问答ime. How do you deal with whoever submits payment last?


When a user adds a limited-supply item to their shopping cart, put a hold on the item for a small window of time - say, 15 minutes. It's theirs if they pay within the window, otherwise the hold is removed and the item is returned to the pool. (For the duration of the hold, the item considered "not available" to other users.)

AFAIK, it's pretty standard technique - I've seen Gilt do this, for instance.

0

精彩评论

暂无评论...
验证码 换一张
取 消