Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store pickup orders race condition: reserve source items QTY #2032

Closed
maghamed opened this issue Feb 10, 2019 · 1 comment
Closed

Store pickup orders race condition: reserve source items QTY #2032

maghamed opened this issue Feb 10, 2019 · 1 comment

Comments

@maghamed
Copy link
Contributor

maghamed commented Feb 10, 2019

Race condition between orders

To prevent a race condition between orders. Which could happen in a next case:

The "Salable Quantity" on "Custom Stock" is 10 for SKU-1. "Custom Stock" consists of three sources:

  • Source A, which contains 5 items of SKU-1
  • Source B, which contains 4 items of SKU-1
  • Source C, which contains 1 item of SKU-1

Altogether it gives us 5 + 4 + 1 = 10
Now there are 2 Customers coming to the site to place orders:

  • Customer 1 orders 2 items of SKU-1 and choose a general delivery method (NOT Store Pickup)
  • Customer 2 orders 4 items of SKU-1 and choose as a delivery method Store Pickup

With current behaviour of Source Selection Algorithm it could happen that if Customer's 1 order would be processed first, the SSA may suggest to make Source deduction from "Source A" which will lead to insufficient Quantity of SKU-1 (5 - 2 < 4) to fulfill the order placed by Customer 2.

To prevent this situation it's proposed to apply a rule that Store Pickup orders have higher priority than others, and SSA should work not with Source Availability Quantity, but with Source Availability Quantity minus all store pickup ordered quantities. In the case above it means that SSA for Customer 1 order should take Order placed by Customer 2 into account even so Order 2 was placed later, and the inbound data for SSA would be:

  • Source A: 5 - 4 = 1 (subtract all store pickup items for this Source)
  • Source B: 4
  • Source C: 1

https://github.com/magento-engcom/msi/wiki/Support-of-Store-Pickup-for-Multi-Source-Inventory#Race-condition-between-orders

@maghamed maghamed added this to the MSI Part III milestone Feb 10, 2019
@novikor novikor self-assigned this May 4, 2019
@novikor novikor changed the title For Orders placed with Store Pickup - Skip the SSA step Store pickup orders race condition: reserve source items QTY May 11, 2019
novikor added a commit that referenced this issue May 11, 2019
Decrement source item qty if its reserved by orders placed using its source
novikor added a commit that referenced this issue May 12, 2019
novikor added a commit that referenced this issue May 18, 2019
Renamed: $sourceCode => $pickupLocationCode
@swnsma
Copy link
Contributor

swnsma commented May 27, 2019

Merged in #2237.

@swnsma swnsma closed this as completed May 27, 2019
ishakhsuvarov pushed a commit that referenced this issue Nov 22, 2019
Decrement source item qty if its reserved by orders placed using its source
ishakhsuvarov pushed a commit that referenced this issue Nov 22, 2019
ishakhsuvarov pushed a commit that referenced this issue Nov 22, 2019
Renamed: $sourceCode => $pickupLocationCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants