Skip to content

Commit

Permalink
Only index pages on active store (#82)
Browse files Browse the repository at this point in the history
* only index pages on active store
  • Loading branch information
tunght13488 authored and Jan Petr committed Oct 24, 2016
1 parent 7764511 commit 9f8d51f
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions Model/Indexer/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ class Page implements Magento\Framework\Indexer\ActionInterface, Magento\Framewo
private $configHelper;
private $messageManager;

public function __construct(StoreManagerInterface $storeManager,
PageHelper $pageHelper,
Data $helper,
AlgoliaHelper $algoliaHelper,
Queue $queue,
ConfigHelper $configHelper,
ManagerInterface $messageManager)
{
public function __construct(
StoreManagerInterface $storeManager,
PageHelper $pageHelper,
Data $helper,
AlgoliaHelper $algoliaHelper,
Queue $queue,
ConfigHelper $configHelper,
ManagerInterface $messageManager
) {
$this->fullAction = $helper;
$this->storeManager = $storeManager;
$this->pageHelper = $pageHelper;
Expand Down Expand Up @@ -56,7 +57,12 @@ public function executeFull()
return;
}

$storeIds = array_keys($this->storeManager->getStores());
$storeIds = [];
foreach ($this->storeManager->getStores() as $store) {
if ($store->isActive()) {
$storeIds[] = $store->getId();
}
}

foreach ($storeIds as $storeId) {
$this->queue->addToQueue($this->fullAction, 'rebuildStorePageIndex', ['store_id' => $storeId], 1);
Expand Down

0 comments on commit 9f8d51f

Please sign in to comment.