Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
class FixStuckIndexers
{
    public function execute()
    {
        $this->fixStuckIndexers->execute();
    }
}

Logic to fix indexers

vendor/creativestyle/magesuite-stuck-indexers-fixer/Model/FixStuckIndexers.php:24
Code Block
breakoutModewide
class FixStuckIndexers
{
    public function execute()
    {
        if ($this->configuration->shouldEnableSuspendedIndexes()) {
            $this->fixSuspendedIndexes();
        }

        if (!$this->configuration->isAutomaticFixingEnabled()) {
            return;
        }

        $thresholdToMarkIndexerAsStuck = $this->configuration->getThresholdToMarkIndexerAsStuck();

        $this->fixStuckIndexers($thresholdToMarkIndexerAsStuck);
    }

    protected function fixSuspendedIndexes()
    {
        $suspendedMview = $this->mviewState->getSuspendedIndexers() ?? [];

        foreach ($suspendedMview as $mview) {
            $this->mviewState->setIndexerAsIdle($mview['view_id']);
            .....
        }
    }

    protected function fixStuckIndexers($threshold)
    {
        $stuckMview = $this->mviewState->getStuckIndexers($threshold) ?? [];

        foreach ($stuckMview as $mview) {
            $this->mviewState->setIndexerAsIdle($mview['view_id']);
            .....
        }

        $stuckFull = $this->indexerState->getStuckIndexers($threshold) ?? [];

        foreach ($stuckFull as $indexer) {
            $this->indexerState->setIndexerAsInvalid($indexer['indexer_id']);
            .....
        }
    }
}

...