StuckIndexersFixer

https://github.com/magesuite/stuck-indexers-fixer

The module unblocks indexers that got stuck.

Installation

This module is a part of MageSuite metapackage

Installation if metapackage is not used:

composer require "creativestyle/magesuite-stuck-indexers-fixer" ^1.0.0

Admin settings

Admin settings are located in Stores -> Configuration -> Advanced -> System -> Stuck Indexer Fixer

Settings:

Field

Options

Comment

Field

Options

Comment

Enable Automatic Stuck Indexes Fixing

Yes/No 

When enabled indexing that got somehow stuck will be automatically detected and fixed

Shoud enable suspended indexes

Yes/No 

When enabled indexing that got suspended will be automatically detected and fixed

Threshold to mark indexer as stuck

 

How long (in minutes) from the last activity must pass for indexer in a "working" status to treat it as stuck.

Cron expression for scheduling the fixer

 

Use Crontab Format (Eg. "*/5 * * * *" for every 5 minutes) | https://en.wikipedia.org/wiki/Cron

Backend

In progress

Cron

vendor/creativestyle/magesuite-stuck-indexers-fixer/Cron/FixStuckIndexers.php:14
class FixStuckIndexers { public function execute() { $this->fixStuckIndexers->execute(); } }

 

Logic to fix indexers

vendor/creativestyle/magesuite-stuck-indexers-fixer/Model/FixStuckIndexers.php:24
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']); ..... } } }

 

MviewState

Get stuck and suspended indexers, also set indexer status as idle

vendor/creativestyle/magesuite-stuck-indexers-fixer/Model/ResourceModel/MviewState.php:14

 

Frontend

There are no frontend features in the module.