Problem/Motivation
I was updating a line item quantity on the cart and the total below was showing the previous value.
The line item controller's cache was set during save, then immediately after removed from entityCache via a reset.
Because the commerce order load is inside a transaction, any read to that changed line item would have no value, look in the database (which hasn't been committed yet) and try to load from the database (which gives the previous value).
Proposed resolution
Remove the controller clear cache for line items right after their saves.
Remaining tasks
Probably needs tests.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | cart_order_totals-2657792-3.patch | 2 KB | joelpittet |
| #2 | cart_order_totals-2657792-2.patch | 1.84 KB | joelpittet |
Comments
Comment #2
joelpittetComment #3
joelpittetMissed the comment above one.
Comment #4
joelpittetComment #5
joelpittetRemoving steps to reproduce this, they seemed to be related to adpqc cache backend's transactions.
I still think this a bug and likely has some performance benefits as it doesn't have to ask the DB for line item information it already has!
Comment #6
smccabe commentedReviewed the patch, the resetCache calls do seem pointless, the save() calls already update the cache and clears the lock if possible, so they are not really serving any purpose other than forcing us to reload something later that we don't need to.
Comment #7
rszrama commentedFixed.
Comment #9
rszrama commented