diff --git a/vendor/magento/module-indexer/Model/ProcessManager.php b/vendor/magento/module-indexer/Model/ProcessManager.php index b6fd158364dea..d682f04344eb1 100644 --- a/vendor/magento/module-indexer/Model/ProcessManager.php +++ b/vendor/magento/module-indexer/Model/ProcessManager.php @@ -1,7 +1,7 @@ threadsCount > 1 && $this->isCanBeParalleled() && !$this->isSetupMode() && PHP_SAPI == 'cli') { + if ($this->isMultiThreadsExecute()) { $this->multiThreadsExecute($userFunctions); } else { $this->simpleThreadExecute($userFunctions); @@ -185,4 +185,14 @@ private function executeParentProcess(int &$threadNumber) $threadNumber--; } } + + /** + * Check if the current process is multithreaded + * + * @return bool + */ + public function isMultiThreadsExecute(): bool + { + return $this->threadsCount > 1 && $this->isCanBeParalleled() && !$this->isSetupMode() && PHP_SAPI == 'cli'; + } }