Skip to content

Commit 2eac274

Browse files
MAGETWO-64954: [Performance] Fix innodb_lock_wait_timeout in the application
1 parent 03b0749 commit 2eac274

File tree

1 file changed

+11
-13
lines changed
  • lib/internal/Magento/Framework/Mview

1 file changed

+11
-13
lines changed

lib/internal/Magento/Framework/Mview/View.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
*/
1717
class View extends \Magento\Framework\DataObject implements ViewInterface
1818
{
19+
/**
20+
* Default batch size for partial reindex
21+
*/
22+
const DEFAULT_BATCH_SIZE = 1000;
23+
1924
/**
2025
* @var string
2126
*/
@@ -49,17 +54,7 @@ class View extends \Magento\Framework\DataObject implements ViewInterface
4954
/**
5055
* @var array
5156
*/
52-
protected $changelogBatchSize = [
53-
'default_size' => 1000,
54-
'catalog_category_product' => 1000,
55-
'catalog_product_category' => 1000,
56-
'catalog_product_price' => 1000,
57-
'catalog_product_attribute' => 1000,
58-
'cataloginventory_stock' => 1000,
59-
'catalogrule_rule' => 1000,
60-
'catalogrule_product' => 1000,
61-
'catalogsearch_fulltext' => 1000,
62-
];
57+
private $changelogBatchSize;
6358

6459
/**
6560
* @param ConfigInterface $config
@@ -68,20 +63,23 @@ class View extends \Magento\Framework\DataObject implements ViewInterface
6863
* @param View\ChangelogInterface $changelog
6964
* @param SubscriptionFactory $subscriptionFactory
7065
* @param array $data
66+
* @param array $changelogBatchSize
7167
*/
7268
public function __construct(
7369
ConfigInterface $config,
7470
ActionFactory $actionFactory,
7571
View\StateInterface $state,
7672
View\ChangelogInterface $changelog,
7773
SubscriptionFactory $subscriptionFactory,
78-
array $data = []
74+
array $data = [],
75+
array $changelogBatchSize = []
7976
) {
8077
$this->config = $config;
8178
$this->actionFactory = $actionFactory;
8279
$this->state = $state;
8380
$this->changelog = $changelog;
8481
$this->subscriptionFactory = $subscriptionFactory;
82+
$this->changelogBatchSize = $changelogBatchSize;
8583
parent::__construct($data);
8684
}
8785

@@ -276,7 +274,7 @@ public function update()
276274

277275
$batchSize = isset($this->changelogBatchSize[$this->getChangelog()->getViewId()])
278276
? $this->changelogBatchSize[$this->getChangelog()->getViewId()]
279-
: $this->changelogBatchSize['default_size'];
277+
: self::DEFAULT_BATCH_SIZE;
280278

281279
for ($versionFrom = $lastVersionId; $versionFrom < $currentVersionId; $versionFrom += $batchSize) {
282280
$ids = $this->getChangelog()->getList($versionFrom, $versionFrom + $batchSize);

0 commit comments

Comments
 (0)