Glue: Parallel cart item quantity updates lead to data loss


#1

Hi there,

we’re using the carts-rest-api module for Glue.

We’re currently experiencing the loss of data, if a client fires multiple parallel requests to PATCH /carts/<cartId>/items/<sku> endpoint. More precise, it’s like some requests are beeing ignored, as the updated cart does not contain the updated quantities for some items.

Our guess:
As there’s no “lock” on the cart, it happens that parallel patches are applied at the same time.
Internally Spryker works with a “clone” of the current cart and writes it back to the session, once all operations are completed.
Due to this, e.g. the second request will start without the updated data of the first request.
Once finished, it immediately overwrites the changes from the first request.

Can you please confirm this bug?

Additionally, as far as we know, there currently is no support for “bulk” updates on the cart, is this correct?

Best regards
Felix


#2

Hi Felix,

You are right, there are no “bulk” updates on the cart atm.

As about multiple PATCH requests at once to the same cart we will investigate this.

Thank you for the report.

Best regards,
Valerii


#3

Hi, Felix,

Could you please describe how did you sent these requests and did you get errors.

Thank you in advance.

Best regards,
Tihran


#4

Hi voitovtihran,

we used Postman to fire two requests with just little delay in between.

We did not get any error message, the response always returned the current cart.
I just tested it again. In the patch response, the item quantity is updated correctly.

But when requesting the cart after both requests again, only one change is applied.

Best regards
Felix


#5

Hi, Felix,

Could you please tell if you request update for different items of for the same?

Thank you in advance.

Best regards,
Tihran


#6

Hi voitovtihran,

we tried to update the quantity of different items of same cart.

Best regards
Felix


#7

Hi, Felix,

We will reproduce and investigate issue.

Best regards,
Tihran


#8

Hi Felix,

We were able to reproduce and can confirm this issue. Thank you for the report. I will notify here when it’s fixed and released.

Best regards,
Valerii