reactioncommerce/reaction
View on GitHubcancelOrderItem can't deal with concurrent requests properly
Open
#6493 opened on Jan 20, 2021
buggood first issueneeds triage
Description
Issue Description
If cancelOrderItem is fired in parallel for multiple fulfillment groups of an order, only some of them might receive an update.
You can see this in action on the current order admin, which fires them in parallel if you click "Cancel Order" (Might be reconsidered in general, network errors should not result in an order being partially cancelled.)
Steps to Reproduce
- Create an order with two fulfillment groups
- Click "Cancel order" in the admin
- Notice that only one of the fulfillment groups updated their status
Possible Solution
The reason for this is that the mutation will process the whole shipping array of an order in memory and write that to the db - Parallel updates to it will get lost.
Options could either be to add some locking mechanism on this, or to just to rewrite this to make atomic operations instead of replacing the whole array.
Versions
latest