Skip to content

Commit 6e6fff2

Browse files
committed
MC-41807: Partial Catalog Product Price Indexing not removing old price date and is extremely slow if store has many products (above 200k)
1 parent bf4cdad commit 6e6fff2

File tree

3 files changed

+12
-107
lines changed

3 files changed

+12
-107
lines changed

app/code/Magento/CatalogRule/Cron/DailyCatalogUpdate.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
namespace Magento\CatalogRule\Cron;
88

9-
use Magento\CatalogRule\Model\Indexer\PartialIndex;
109
use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
10+
use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory as RuleCollectionFactory;
1111

1212
/**
1313
* Daily update catalog price rule by cron
@@ -20,24 +20,25 @@ class DailyCatalogUpdate
2020
protected $ruleProductProcessor;
2121

2222
/**
23-
* @var PartialIndex
23+
* @var RuleCollectionFactory
2424
*/
25-
private $partialIndex;
25+
private $ruleCollectionFactory;
2626

2727
/**
2828
* @param RuleProductProcessor $ruleProductProcessor
29-
* @param PartialIndex $partialIndex
29+
* @param RuleCollectionFactory $ruleCollectionFactory
3030
*/
3131
public function __construct(
3232
RuleProductProcessor $ruleProductProcessor,
33-
PartialIndex $partialIndex
33+
RuleCollectionFactory $ruleCollectionFactory
3434
) {
3535
$this->ruleProductProcessor = $ruleProductProcessor;
36-
$this->partialIndex = $partialIndex;
36+
$this->ruleCollectionFactory = $ruleCollectionFactory;
3737
}
3838

3939
/**
4040
* Daily update catalog price rule by cron
41+
*
4142
* Update include interval 3 days - current day - 1 days before + 1 days after
4243
* This method is called from cron process, cron is working in UTC time and
4344
* we should generate data for interval -1 day ... +1 day
@@ -46,8 +47,10 @@ public function __construct(
4647
*/
4748
public function execute()
4849
{
49-
$this->ruleProductProcessor->isIndexerScheduled()
50-
? $this->partialIndex->partialUpdateCatalogRuleProductPrice()
51-
: $this->ruleProductProcessor->markIndexerAsInvalid();
50+
$ruleCollection = $this->ruleCollectionFactory->create();
51+
$ruleCollection->addIsActiveFilter();
52+
if ($ruleCollection->getSize()) {
53+
$this->ruleProductProcessor->markIndexerAsInvalid();
54+
}
5255
}
5356
}

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

Lines changed: 0 additions & 97 deletions
This file was deleted.

app/code/Magento/CatalogRule/etc/mview.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
<view id="catalog_product_price" class="Magento\Catalog\Model\Indexer\Product\Price" group="indexer">
2828
<subscriptions>
2929
<table name="catalogrule_product_price" entity_column="product_id" />
30-
<table name="catalogrule_product_price_replica" entity_column="product_id" />
3130
</subscriptions>
3231
</view>
3332
</config>

0 commit comments

Comments
 (0)