@@ -65,18 +65,12 @@ class Layered implements IndexerActionInterface, MviewActionInterface
65
65
*/
66
66
private $ indexMutex ;
67
67
68
- /**
69
- * @var LoggerInterface
70
- */
71
- private $ logger ;
72
-
73
68
/**
74
69
* @param Layered\Action\FullFactory $fullActionFactory
75
70
* @param Layered\Action\RowsFactory $rowsActionFactory
76
71
* @param IndexerRegistry $indexerRegistry
77
72
* @param CacheContext $cacheContext
78
73
* @param IndexMutexInterface $indexMutex
79
- * @param LoggerInterface $logger
80
74
* @param string $indexerId
81
75
*/
82
76
public function __construct (
@@ -85,15 +79,13 @@ public function __construct(
85
79
IndexerRegistry $ indexerRegistry ,
86
80
CacheContext $ cacheContext ,
87
81
IndexMutexInterface $ indexMutex ,
88
- LoggerInterface $ logger ,
89
82
string $ indexerId = self ::INDEXER_ID
90
83
) {
91
84
$ this ->fullActionFactory = $ fullActionFactory ;
92
85
$ this ->rowsActionFactory = $ rowsActionFactory ;
93
86
$ this ->indexerRegistry = $ indexerRegistry ;
94
87
$ this ->cacheContext = $ cacheContext ;
95
88
$ this ->indexMutex = $ indexMutex ;
96
- $ this ->logger = $ logger ;
97
89
$ this ->indexerId = $ indexerId ;
98
90
}
99
91
@@ -105,13 +97,8 @@ public function __construct(
105
97
*/
106
98
public function execute ($ ids )
107
99
{
108
- try {
109
- $ this ->executeAction ($ ids );
110
- $ this ->registerEntities ($ ids );
111
- } catch (\Exception $ e ) {
112
- $ this ->logger ->error ('Error during indexing specific entities: ' . $ e ->getMessage (), ['exception ' => $ e ]);
113
- throw new LocalizedException (__ ('Could not rebuild index for specified entities: %1 ' , $ e ->getMessage ()), $ e );
114
- }
100
+ $ this ->executeAction ($ ids );
101
+ $ this ->registerEntities ($ ids );
115
102
}
116
103
117
104
/**
@@ -122,24 +109,14 @@ public function execute($ids)
122
109
public function executeFull ()
123
110
{
124
111
$ indexer = $ this ->indexerRegistry ->get ($ this ->indexerId );
125
-
126
- if ($ indexer ->isScheduled ()) {
127
- // Skip manual reindex if indexer is in scheduled mode
128
- return ;
129
- }
130
-
131
- try {
132
- $ this ->indexMutex ->execute (
133
- $ this ->indexerId ,
134
- function () {
135
- $ this ->fullActionFactory ->create ()->execute ();
136
- $ this ->registerTags ();
137
- }
138
- );
139
- } catch (\Exception $ e ) {
140
- $ this ->logger ->error ('Error during full reindex: ' . $ e ->getMessage (), ['exception ' => $ e ]);
141
- throw new LocalizedException (__ ('Could not rebuild index for all entities: %1 ' , $ e ->getMessage ()), $ e );
142
- }
112
+
113
+ $ this ->indexMutex ->execute (
114
+ $ this ->indexerId ,
115
+ function () {
116
+ $ this ->fullActionFactory ->create ()->execute ();
117
+ $ this ->registerTags ();
118
+ }
119
+ );
143
120
}
144
121
145
122
/**
@@ -150,15 +127,7 @@ function () {
150
127
*/
151
128
public function executeList (array $ ids )
152
129
{
153
- try {
154
- $ this ->executeAction ($ ids );
155
- } catch (\Exception $ e ) {
156
- $ this ->logger ->error ('Error during executing mview by ID list: ' . $ e ->getMessage (), [
157
- 'exception ' => $ e ,
158
- 'ids ' => implode (', ' , $ ids )
159
- ]);
160
- throw new LocalizedException (__ ('Could not rebuild index for the specified entities: %1 ' , $ e ->getMessage ()), $ e );
161
- }
130
+ $ this ->executeAction ($ ids );
162
131
}
163
132
164
133
/**
@@ -186,11 +155,7 @@ private function executeAction(array $ids)
186
155
187
156
$ ids = array_unique ($ ids );
188
157
$ indexer = $ this ->indexerRegistry ->get ($ this ->indexerId );
189
-
190
- if (!$ indexer ->isScheduled ()) {
191
- $ this ->rowsActionFactory ->create ()->execute ($ ids );
192
- }
193
-
158
+ $ this ->rowsActionFactory ->create ()->execute ($ ids );
194
159
return $ this ;
195
160
}
196
161
@@ -214,4 +179,4 @@ private function registerTags()
214
179
{
215
180
$ this ->cacheContext ->registerTags ([CustomEntity::CACHE_TAG ]);
216
181
}
217
- }
182
+ }
0 commit comments