Skip to content

Commit 427f7b3

Browse files
authored
Update indexer:reset to call indexer->invalidate()
I was recently debugging something that was invalidating the indexers. I added some logging using a before plugin on the `invalidate` function https://github.com/magento/magento2/blob/227cf9229152ed4332c607796cf476055ef9ec4f/app/code/Magento/Indexer/Model/Indexer.php#L345-L355 But this use case isn't covered. It seems to me that this command should just call the function that invalidates the indexer rather than repeating the work itself.
1 parent 227cf92 commit 427f7b3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
3636
$indexers = $this->getIndexers($input);
3737
foreach ($indexers as $indexer) {
3838
try {
39-
$indexer->getState()
40-
->setStatus(\Magento\Framework\Indexer\StateInterface::STATUS_INVALID)
41-
->save();
39+
$indexer->invalidate();
4240
$output->writeln($indexer->getTitle() . ' indexer has been invalidated.');
4341
} catch (LocalizedException $e) {
4442
$output->writeln($e->getMessage());

0 commit comments

Comments
 (0)