Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance middleware; improve trigger perf; add cart_full #740

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

rgalanakis
Copy link
Member

Improve trigger performance, add cart_full

  • Add a cache to payment contexts that can store arbitrary data
    during the lifetime of the context. This allows us to call something
    like Trigger.gather (which uses datasets) multiple times,
    but only call the database once.
  • Fix the issue where users could add too much to their cart
    which would be prohibited at checkout due to offering item limits.
    Instead, whenever we add a cart item, we return the full offering,
    (which contains the cart), rather than just the cart.
  • This fix required making max_quantity_for take into account
    the items already in the cart.
  • Add a new 'cart full' concept, to differentiate when a product
    has a zero quantity because it's out of stock (or unavailable
    because the user has already ordered too much),
    or whether it's zero quantity because they can't add any more of it
    because of what's in the current cart.

Use dynamic translation on order history


Add performance middleware

For each request, log out things like the total number of
sql queries and time spent in the database+driver.
At higher levels of logging,
also print out all the duplicate/similar queries.

For each request, log out things like the total number of
sql queries and time spent in the database+driver.
At higher levels of logging,
also print out all the duplicate/similar queries.
- Add a cache to payment contexts that can store arbitrary data
  during the lifetime of the context. This allows us to call something
  like `Trigger.gather` (which uses datasets) multiple times,
  but only call the database once.
- Fix the issue where users could add too much to their cart
  which would be prohibited at checkout due to offering item limits.
  Instead, whenever we add a cart item, we return the full offering,
  (which contains the cart), rather than just the cart.
- This fix required making `max_quantity_for` take into account
  the items already in the cart.
- Add a new 'cart full' concept, to differentiate when a product
  has a zero quantity because it's out of stock (or unavailable
  because the user has *already ordered* too much),
  or whether it's zero quantity because they can't add any more of it
  because of what's *in the current cart.*
The dataset version was not specifying an explicit order
(the eager version was), so which one came back first
(direct vs. indirect) was inconsistent.
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.73%. Comparing base (c11b3f3) to head (55f4ba7).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
+ Coverage   98.72%   98.73%   +0.01%     
==========================================
  Files         466      468       +2     
  Lines       21163    21340     +177     
==========================================
+ Hits        20893    21071     +178     
+ Misses        270      269       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@rgalanakis rgalanakis merged commit 3bd6dd4 into main Nov 21, 2024
5 checks passed
@rgalanakis rgalanakis deleted the trigger-perf branch November 21, 2024 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant