Skip to content

Commit b944f82

Browse files
committed
MC-19646: [Magento Cloud] - Catalog Product Rule Indexer stuck
1 parent 0ccc1ee commit b944f82

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,17 @@ protected function doReindexByIds($ids)
295295
foreach ($ids as $productId) {
296296
foreach ($activeRules as $activeRule) {
297297
$rule = clone $activeRule;
298-
$rule->setProductsFilter($productId);
298+
$rule->setProductsFilter($ids);
299299
$matchedProductIds = $rule->getMatchingProductIds();
300-
if (!isset($matchedProductIds[$productId])) {
301-
continue;
300+
$matchedProductIds = array_intersect_key($matchedProductIds, array_flip($ids));
301+
foreach ($matchedProductIds as $matchedProductId => $validationByWebsite) {
302+
$websiteIds = array_keys(array_filter($validationByWebsite));
303+
if (empty($websiteIds)) {
304+
continue;
305+
}
306+
307+
$this->assignProductToRule($rule, $matchedProductId, $websiteIds);
302308
}
303-
304-
$websiteIds = array_keys(array_filter($matchedProductIds[$productId]));
305-
if (empty($websiteIds)) {
306-
continue;
307-
}
308-
309-
$this->assignProductToRule($rule, $productId, $websiteIds);
310309
}
311310

312311
$this->cleanProductPriceIndex([$productId]);

0 commit comments

Comments
 (0)