Skip to content

Commit a70f50c

Browse files
committed
MC-19646: [Magento Cloud] - Catalog Product Rule Indexer stuck
1 parent 1371a67 commit a70f50c

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -292,23 +292,8 @@ protected function doReindexByIds($ids)
292292

293293
/** @var Rule[] $activeRules */
294294
$activeRules = $this->getActiveRules()->getItems();
295-
foreach ($activeRules as $activeRule) {
296-
$rule = clone $activeRule;
297-
$rule->setProductsFilter($ids);
298-
$matchedProductIds = $rule->getMatchingProductIds();
299-
if (empty($matchedProductIds)) {
300-
continue;
301-
}
302-
303-
$matchedProductIds = array_intersect_key($matchedProductIds, array_flip($ids));
304-
foreach ($matchedProductIds as $matchedProductId => $validationByWebsite) {
305-
$websiteIds = array_keys(array_filter($validationByWebsite));
306-
if (empty($websiteIds)) {
307-
continue;
308-
}
309-
310-
$this->assignProductToRule($rule, $matchedProductId, $websiteIds);
311-
}
295+
foreach ($activeRules as $rule) {
296+
$this->reindexRuleProduct->execute($rule, $this->batchCount);
312297
}
313298

314299
foreach ($ids as $productId) {

app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\CatalogRuleConfigurable\Plugin\CatalogRule\Model\Rule;
87

9-
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
108
use Magento\CatalogRuleConfigurable\Plugin\CatalogRule\Model\ConfigurableProductsProvider;
119

1210
/**
13-
* Add configurable sub products to catalog rule indexer on full reindex
11+
* Add configurable sub products to catalog rule indexer on reindex
1412
*/
1513
class ConfigurableProductHandler
1614
{
@@ -42,9 +40,12 @@ public function __construct(
4240
}
4341

4442
/**
43+
* Add configurable products during setting product ids for filtering
44+
*
4545
* @param \Magento\CatalogRule\Model\Rule $rule
4646
* @param int|array $productIds
4747
* @return array
48+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4849
*/
4950
public function beforeSetProductsFilter(\Magento\CatalogRule\Model\Rule $rule, $productIds)
5051
{
@@ -62,6 +63,8 @@ public function beforeSetProductsFilter(\Magento\CatalogRule\Model\Rule $rule, $
6263
}
6364

6465
/**
66+
* Add configurable products for matched products
67+
*
6568
* @param \Magento\CatalogRule\Model\Rule $rule
6669
* @param array $productIds
6770
* @return array

0 commit comments

Comments
 (0)