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.

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
Issue tags: +Commerce Sprint
StatusFileSize
new1.84 KB
joelpittet’s picture

StatusFileSize
new2 KB

Missed the comment above one.

joelpittet’s picture

Issue summary: View changes
joelpittet’s picture

Issue summary: View changes
Issue tags: -Needs tests +Performance

Removing 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!

smccabe’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed 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.

rszrama’s picture

Status: Reviewed & tested by the community » Fixed

Fixed.

  • rszrama committed bf9f318 on 7.x-1.x authored by joelpittet
    Issue #2657792 by joelpittet: Cart order totals incorrect after updating...
rszrama’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.