-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
In-memory order updater #5872
Draft
benjaminwil
wants to merge
20
commits into
solidusio:main
Choose a base branch
from
SuperGoodSoft:in-memory-order-updater
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
In-memory order updater #5872
benjaminwil
wants to merge
20
commits into
solidusio:main
from
SuperGoodSoft:in-memory-order-updater
+827
−10
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
the
changelog:solidus_core
Changes to the solidus_core gem
label
Oct 11, 2024
benjaminwil
force-pushed
the
in-memory-order-updater
branch
2 times, most recently
from
October 11, 2024 22:19
27f19a8
to
340032c
Compare
forkata
force-pushed
the
in-memory-order-updater
branch
from
November 8, 2024 22:34
d22210b
to
d244646
Compare
Just making a note that we are waiting on Alistair to rebase #6026 against this. @AlistairNorman could you just make sure that gets done at some point before the 20th? That way we can have it for our next session. |
https://github.com/sds/db-query-matchers Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Harmony Evangelina <[email protected]> Co-authored-by: Jared Norman <[email protected]> Co-authored-by: Nick Van Doorn <[email protected]> Co-authored-by: Noah Silvera <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Sofia Besenski <[email protected]> Co-authored-by: Tom Van Manen <[email protected]>
In subsequent commits we'll ensure that this can update orders in memory, without persisting changes using manipulative DB queries. Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Harmony Evangelina <[email protected]> Co-authored-by: Jared Norman <[email protected]> Co-authored-by: Nick Van Doorn <[email protected]> Co-authored-by: Noah Silvera <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Sofia Besenski <[email protected]> Co-authored-by: Tom Van Manen <[email protected]>
We want our new in-memory order updater to be able to persist or not persist changes to the order record. WORK IN PROGRESS This is a first step in ensuring we don't need to write to the database using the order updater. Clearly we have more work to do to ensure this functions like the existing updater. Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Harmony Evangelina <[email protected]> Co-authored-by: Jared Norman <[email protected]> Co-authored-by: Nick Van Doorn <[email protected]> Co-authored-by: Noah Silvera <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Sofia Besenski <[email protected]> Co-authored-by: Tom Van Manen <[email protected]>
This is in service of supporting the InMemoryOrderUpdater's goal to not do database writes.
…atabase writes We have prevented write calls to update the cost and `updated_at` of a shipment, as well as allowed us to conditionally persist item totals, by passing down the `persist` argument to that method. Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Harmony Evangelina <[email protected]> Co-authored-by: Kendra Riga <[email protected]> Co-authored-by: Jared Norman <[email protected]> Co-authored-by: Tom Van Manen <[email protected]> Co-authored-by: Chris Todorov <[email protected]> Co-authored-by: Sofia Besenski <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Benjamin Willems <[email protected]>
Update implies that we are persisting the change in Rails, which this method does not do. Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Kendra Riga <[email protected]> Co-authored-by: Sofia Besenski <[email protected]> Co-authored-by: Benjamin Willems <[email protected]>
Update implies that we are persisting the change in Rails, which this method does not do. Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Benjamin Willems <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Sofia Besenski <[email protected]> Co-authored-by: Kendra Riga <[email protected]>
These methods don't persist so it's more accurate to say that they recalculate the total instead of saying that they update it. Co-Authored-By: Adam Mueller <[email protected]> Co-Authored-By: Benjamin Willems <[email protected]> Co-Authored-By: Andrew Stewart <[email protected]> Co-Authored-By: Harmony Bouvier <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: Chris Todorov <[email protected]> Co-Authored-By: Tom Van Manen <[email protected]> Co-Authored-By: Noah Silvera <[email protected]>
We want all the methods that might persist data to be called update_ instead of recalculate to be clear that they hit the database. Co-Authored-By: Adam Mueller <[email protected]> Co-Authored-By: Benjamin Willems <[email protected]> Co-Authored-By: Andrew Stewart <[email protected]> Co-Authored-By: Harmony Bouvier <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: Chris Todorov <[email protected]> Co-Authored-By: Tom Van Manen <[email protected]> Co-Authored-By: Noah Silvera <[email protected]>
This is calling the recalculate method not update_adjustments. Co-Authored-By: Adam Mueller <[email protected]> Co-Authored-By: Benjamin Willems <[email protected]> Co-Authored-By: Andrew Stewart <[email protected]> Co-Authored-By: Harmony Bouvier <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: Chris Todorov <[email protected]> Co-Authored-By: Tom Van Manen <[email protected]> Co-Authored-By: Noah Silvera <[email protected]>
This puts all the update and recalculate methods together. Co-Authored-By: Adam Mueller <[email protected]> Co-Authored-By: Benjamin Willems <[email protected]> Co-Authored-By: Andrew Stewart <[email protected]> Co-Authored-By: Harmony Bouvier <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: Chris Todorov <[email protected]> Co-Authored-By: Tom Van Manen <[email protected]> Co-Authored-By: Noah Silvera <[email protected]>
We want to start breaking out some of the complex logic of the in memory updater into smaller more focused classes. Co-Authored-By: Adam Mueller <[email protected]> Co-Authored-By: Benjamin Willems <[email protected]> Co-Authored-By: Andrew Stewart <[email protected]> Co-Authored-By: Harmony Bouvier <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: Chris Todorov <[email protected]> Co-Authored-By: Tom Van Manen <[email protected]> Co-Authored-By: Noah Silvera <[email protected]>
AlistairNorman
force-pushed
the
in-memory-order-updater
branch
from
December 19, 2024 18:27
a3bb1fc
to
06e3a2a
Compare
This is just a stub for now, but we want to eventually introduce a class to handle running the promotion adjustments in memory. Co-authored-by: Adam Mueller <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Harmony Evangelina <[email protected]> Co-authored-by: Kendra Riga <[email protected]> Co-authored-by: Jared Norman <[email protected]> Co-authored-by: Tom Van Manen <[email protected]> Co-authored-by: Senem Soy <[email protected]> Co-authored-by: Benjamin Willems <[email protected]>
Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: benjamin wil <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]>
stewart
force-pushed
the
in-memory-order-updater
branch
from
December 20, 2024 21:30
9fd5c8d
to
27e4988
Compare
Co-Authored-By: Harmony Evangelina <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: benjamin wil <[email protected]>
This change more clearly splits up the logic for recalculating shipment/item adjustment totals from the logic for persisting updated values to the database. Continuing to colocating logic for recalculating item totals in one PORO makes it easier to reason about and helps to simplify the higher-level order updater. Co-Authored-By: Harmony Evangelina <[email protected]> Co-Authored-By: Jared Norman <[email protected]> Co-Authored-By: Kendra Riga <[email protected]> Co-Authored-By: Sofia Besenski <[email protected]> Co-Authored-By: benjamin wil <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request proposes a replacement to the default
Spree::OrderUpdater
that has new and improved functionality:There may be some beneficial side-effects that come out of this new order updater implementation:
We don't expect this to be the default order updater implementation in the next minor version of Solidus, but we would like to propose it as the default for the next major version of Solidus.
Note: The commits on this pull request have a long list of co-authors, as the Super Good team is approaching this as a collaborative mob programming exercise.
Milestones
For this order updater, we intend to achieve the following during updates:
We appreciate that there is a lot of complexity to achieving these goals (dealing with active promotions, for example).
Notes
Spree::OrderUpdater
makes on a typical recalculate.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: