Skip to content

Commit 340e4eb

Browse files
authored
Merge branch 'develop' into fix/magento232_adapter
2 parents f326abd + f8e98e4 commit 340e4eb

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Model/Indexer/Category.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,23 @@ public function executeRow($id)
101101
*/
102102
private function rebuildAffectedProducts($storeId)
103103
{
104-
$affectedProductsCount = count(self::$affectedProductIds);
104+
$affectedProducts = self::$affectedProductIds;
105+
$affectedProductsCount = count($affectedProducts);
106+
105107
if ($affectedProductsCount > 0 && $this->configHelper->indexProductOnCategoryProductsUpdate($storeId)) {
106-
/** @uses Data::rebuildStoreProductIndex() */
107-
$this->queue->addToQueue(
108-
Data::class,
109-
'rebuildStoreProductIndex',
110-
[
111-
'store_id' => $storeId,
112-
'product_ids' => self::$affectedProductIds,
113-
],
114-
$affectedProductsCount
115-
);
108+
$productsPerPage = $this->configHelper->getNumberOfElementByPage();
109+
foreach (array_chunk($affectedProducts, $productsPerPage) as $chunk) {
110+
/** @uses Data::rebuildStoreProductIndex() */
111+
$this->queue->addToQueue(
112+
Data::class,
113+
'rebuildStoreProductIndex',
114+
[
115+
'store_id' => $storeId,
116+
'product_ids' => $chunk,
117+
],
118+
count($chunk)
119+
);
120+
}
116121
}
117122
}
118123

0 commit comments

Comments
 (0)