django-oscar / django-oscar-accounts

Managed accounts for Django (with or without django-oscar)
BSD 3-Clause "New" or "Revised" License
212 stars 119 forks source link

fix: improve performance on saving models #119

Closed TurnrDev closed 3 years ago

TurnrDev commented 3 years ago

Use update_fields on save when used in a limited context. Also prevents other potentially unwanted data from being saved.

codecov[bot] commented 3 years ago

Codecov Report

Merging #119 (0c30883) into master (2f0db69) will not change coverage. The diff coverage is 83.33%.

:exclamation: Current head 0c30883 differs from pull request most recent head eced5a0. Consider uploading reports for the commit eced5a0 to get more accurate results Impacted file tree graph

@@           Coverage Diff           @@
##           master     #119   +/-   ##
=======================================
  Coverage   64.98%   64.98%           
=======================================
  Files          28       28           
  Lines        1411     1411           
=======================================
  Hits          917      917           
  Misses        494      494           
Impacted Files Coverage Δ
src/oscar_accounts/abstract_models.py 86.82% <83.33%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2f0db69...eced5a0. Read the comment docs.

TurnrDev commented 3 years ago

I've had to fix a test to work with this change. This means that this performance improvement is a potentially breaking change so I've added a note in the docstrings about this.

TurnrDev commented 3 years ago

@solarissmoke All fixed! Life really hit hard but all sorted

TurnrDev commented 3 years ago

Nice, thank you!