Adjustments - Use explicit Row level deleted when computing taxes #38
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.
Tax computation occurs repeatedly per order, per line item, per step during checkout.
Spree::TaxRate computes new Adjustments after deleting the old ones.
A PR in Solidus pointed out that using
delete_all
can result in generated SQL thatcontains polymorphic columns and caused INNODB to take gap locks. Under load this can result
in deadlock.
Using
destroy_all
means only primary key based deletes will occur. No gap locks so deadlocks can beless likely.
spree_adjustments
is a high traffic table. Spree::Adjustment has noafter_destroy
or relations that would invoke logic on destroy so this should be safe.Ref: solidusio/solidus#127