Grouped product indexer | cache clear fix #3402
Open
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.
Preconditions (*)
magento/module-inventory-cache
What is happening?
MSI has this function in place as
around
method. Which gets the product IDs frominventory_stock_ID
table before and after.Pay attention to
around
method here.inventory/InventoryCache/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/CacheFlush.php
Line 51 in 790c7ff
Then, it also has this function as
after
method to index grouped products, which happens after the above function (around) runs, meaning at this time, the system has already sent all the grouped product IDs to clear the cache.inventory/InventoryGroupedProductIndexer/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/ReindexFullPlugin.php
Line 43 in 790c7ff
What this means?
If I have 200 grouped products in my system, every time a single product's (not related to grouped whatsoever) sources deleted/added, then it will send the cache clear request for this product PLUS that 200 grouped products.
Steps to reproduce (*)
bin/magento indexer:reindex inventory
Expected result (*)
Actual result (*)