Closed
Description
Right now while saving product, Magento indexes it in _afterSave()
method.
https://github.com/magento/magento2/blob/master/app/code/core/Mage/Catalog/Model/Product.php line 516
Mage::getSingleton('Mage_Index_Model_Indexer')->processEntityAction( $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE );
The problem is that this method is called before committing save transaction.
see https://github.com/magento/magento2/blob/master/app/code/core/Mage/Core/Model/Abstract.php line 361
Current solution can lead some problems problems
- indexer might use old product data
- if indexer fails, e.g. throws exception, product will not be saved
- transaction stays open for the time of indexing
-....
Instead, indexing product should be done in the event like 'catalog_product_model_save_commit_after'
Metadata
Metadata
Assignees
Labels
No labels