16
16
*/
17
17
class View extends \Magento \Framework \DataObject implements ViewInterface
18
18
{
19
+ /**
20
+ * Default batch size for partial reindex
21
+ */
22
+ const DEFAULT_BATCH_SIZE = 1000 ;
23
+
19
24
/**
20
25
* @var string
21
26
*/
@@ -49,17 +54,7 @@ class View extends \Magento\Framework\DataObject implements ViewInterface
49
54
/**
50
55
* @var array
51
56
*/
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 ;
63
58
64
59
/**
65
60
* @param ConfigInterface $config
@@ -68,20 +63,23 @@ class View extends \Magento\Framework\DataObject implements ViewInterface
68
63
* @param View\ChangelogInterface $changelog
69
64
* @param SubscriptionFactory $subscriptionFactory
70
65
* @param array $data
66
+ * @param array $changelogBatchSize
71
67
*/
72
68
public function __construct (
73
69
ConfigInterface $ config ,
74
70
ActionFactory $ actionFactory ,
75
71
View \StateInterface $ state ,
76
72
View \ChangelogInterface $ changelog ,
77
73
SubscriptionFactory $ subscriptionFactory ,
78
- array $ data = []
74
+ array $ data = [],
75
+ array $ changelogBatchSize = []
79
76
) {
80
77
$ this ->config = $ config ;
81
78
$ this ->actionFactory = $ actionFactory ;
82
79
$ this ->state = $ state ;
83
80
$ this ->changelog = $ changelog ;
84
81
$ this ->subscriptionFactory = $ subscriptionFactory ;
82
+ $ this ->changelogBatchSize = $ changelogBatchSize ;
85
83
parent ::__construct ($ data );
86
84
}
87
85
@@ -276,7 +274,7 @@ public function update()
276
274
277
275
$ batchSize = isset ($ this ->changelogBatchSize [$ this ->getChangelog ()->getViewId ()])
278
276
? $ this ->changelogBatchSize [$ this ->getChangelog ()->getViewId ()]
279
- : $ this -> changelogBatchSize [ ' default_size ' ] ;
277
+ : self :: DEFAULT_BATCH_SIZE ;
280
278
281
279
for ($ versionFrom = $ lastVersionId ; $ versionFrom < $ currentVersionId ; $ versionFrom += $ batchSize ) {
282
280
$ ids = $ this ->getChangelog ()->getList ($ versionFrom , $ versionFrom + $ batchSize );
0 commit comments