Skip to content

Commit

Permalink
Merge pull request #8 from magento-commerce/fix-SEARCH-510
Browse files Browse the repository at this point in the history
Fixed issue with indexer state
  • Loading branch information
akaplya authored Nov 12, 2020
2 parents 027c974 + 32ad151 commit 60445ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Magento\CatalogDataExporter\Model\Indexer;

use Magento\Indexer\Model\Indexer;
use Magento\Indexer\Model\IndexerFactory;

/**
* Class IndexInvalidationManager
Expand All @@ -17,9 +17,9 @@
class IndexInvalidationManager
{
/**
* @var Indexer
* @var IndexerFactory
*/
private $indexer;
private $indexerFactory;

/**
* @var array
Expand All @@ -29,14 +29,14 @@ class IndexInvalidationManager
/**
* IndexInvalidationManager constructor.
*
* @param Indexer $indexer
* @param IndexerFactory $indexerFactory
* @param array $invalidationEvents
*/
public function __construct(
Indexer $indexer,
IndexerFactory $indexerFactory,
array $invalidationEvents
) {
$this->indexer = $indexer;
$this->indexerFactory = $indexerFactory;
$this->invalidationEvents = $invalidationEvents;
}

Expand All @@ -48,8 +48,8 @@ public function __construct(
public function invalidate(string $eventName): void
{
$indexers = isset($this->invalidationEvents[$eventName]) ? $this->invalidationEvents[$eventName] : [];
foreach ($indexers as $indexer) {
$this->indexer->load($indexer)->invalidate();
foreach ($indexers as $indexerId) {
$this->indexerFactory->create()->load($indexerId)->invalidate();
}
}
}
12 changes: 6 additions & 6 deletions app/code/Magento/CatalogDataExporter/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -472,18 +472,18 @@
<argument name="invalidationEvents" xsi:type="array">
<item name="store_changed" xsi:type="array">
<item name="products" xsi:type="string">catalog_data_exporter_products</item>
<item name="categories" xsi:type="string">catalog_data_exporter_product_attributes</item>
<item name="product_attributes" xsi:type="string">catalog_data_exporter_categories</item>
<item name="categories" xsi:type="string">catalog_data_exporter_categories</item>
<item name="product_attributes" xsi:type="string">catalog_data_exporter_product_attributes</item>
</item>
<item name="website_changed" xsi:type="array">
<item name="products" xsi:type="string">catalog_data_exporter_products</item>
<item name="categories" xsi:type="string">catalog_data_exporter_product_attributes</item>
<item name="product_attributes" xsi:type="string">catalog_data_exporter_categories</item>
<item name="categories" xsi:type="string">catalog_data_exporter_categories</item>
<item name="product_attributes" xsi:type="string">catalog_data_exporter_product_attributes</item>
</item>
<item name="group_changed" xsi:type="array">
<item name="products" xsi:type="string">catalog_data_exporter_products</item>
<item name="categories" xsi:type="string">catalog_data_exporter_product_attributes</item>
<item name="product_attributes" xsi:type="string">catalog_data_exporter_categories</item>
<item name="categories" xsi:type="string">catalog_data_exporter_categories</item>
<item name="product_attributes" xsi:type="string">catalog_data_exporter_product_attributes</item>
</item>
</argument>
</arguments>
Expand Down

0 comments on commit 60445ea

Please sign in to comment.