cancelOrderItem can't deal with concurrent requests properly
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
Hi @zenweasel , are planning to implement this. If yes I am interested to work on it.
@chethan27 sorry for the late reply. If you would like to work on this please do. Reach out if you need any help
I am beginner and want to contribute to this project, can you guide me from where should I start?
@lokeshuc Thanks for the contribution.
I think you have the required details in the readme of the reaction repo to get you started. You could check this. Also please check the contribution guide here where you are ready for PR.
I quickly checked if the mutation mentioned above is impacted by the changes in the upcoming release, and it is not.
Please note, the reporter of the issue has provided the steps to reproduce as cancelling the order from admin console which is a separate repo here.
@sujithvn Thanks for the reply ,I will surely check the required details
Hi @janus-reith! :) Is there anyone currently assigned to this issue?
Hi @zenweasel , @janus-reith can I give a try to fix this issue ?
Hi @aditya-padhi-kbl i just assigned you this task
Hi @aditya-padhi-kbl i just assigned you this task
Looking into it
Hi @delagroove , I have set up the environment by following the steps from here
Just wanted to know how can I reproduce the issue so that I can start debugging
@delagroove please assign me the task if its not yet done
Is this bug fixed? if not please assign it to me @janus-reith