Skip to content

Commit f9f3725

Browse files
#29196: Avoids endless loop of indexers being marked as invalid.
1 parent bc2aab7 commit f9f3725

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(
6464
) {
6565
$this->indexerRegistry = $indexerRegistry;
6666
$this->dependencyInfoProvider = $dependencyInfoProvider;
67-
$this->makeSharedValid = $makeSharedValid ?: ObjectManager::getInstance()->get(MakeSharedIndexValid::class);
67+
$this->makeSharedValid = $makeSharedValid;
6868
parent::__construct($objectManagerFactory);
6969
}
7070

@@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9999
// Skip indexers having shared index that was already complete
100100
if (!in_array($sharedIndex, $this->sharedIndexesComplete)) {
101101
$indexer->reindexAll();
102-
if (!empty($sharedIndex) && $this->makeSharedValid->execute($sharedIndex)) {
102+
if (!empty($sharedIndex) && $this->getMakeSharedValid()->execute($sharedIndex)) {
103103
$this->sharedIndexesComplete[] = $sharedIndex;
104104
}
105105
}
@@ -253,4 +253,18 @@ private function getDependencyInfoProvider()
253253
}
254254
return $this->dependencyInfoProvider;
255255
}
256+
257+
/**
258+
* Get MakeSharedIndexValid processor.
259+
*
260+
* @return MakeSharedIndexValid
261+
*/
262+
private function getMakeSharedValid(): MakeSharedIndexValid
263+
{
264+
if (!$this->makeSharedValid) {
265+
$this->makeSharedValid = $this->getObjectManager()->get(MakeSharedIndexValid::class);
266+
}
267+
268+
return $this->makeSharedValid;
269+
}
256270
}

0 commit comments

Comments
 (0)