- Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Area: FrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch
Description
This issue is automatically created based on existing pull request: #34582: 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
public function beforeInvalidate(\Magento\Framework\Indexer\IndexerInterface $subject) { $this->logger->info( "Invalidating index", [ 'indexer_id' => $subject->getId(), 'trace' => str_replace(PHP_EOL, '|', (new \Exception())->getTraceAsString()) ] ); }
But this use case isn't caught in my logs.
It seems to me that this command should just call the function that invalidates the indexer rather than repeating the work itself. I'm sorting out my own logging / debugging internally, but this seems sensible to fix here.
magento2/app/code/Magento/Indexer/Model/Indexer.php
Lines 345 to 355 in 227cf92
/** | |
* Set indexer invalid | |
* | |
* @return void | |
*/ | |
public function invalidate() | |
{ | |
$state = $this->getState(); | |
$state->setStatus(StateInterface::STATUS_INVALID); | |
$state->save(); | |
} |
Manual testing scenarios (*)
- Call
indexer:reset
and see the indexer was invalidated
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- All automated tests passed successfully (all builds are green)
Metadata
Metadata
Assignees
Labels
Area: FrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch
Type
Projects
Status
Done