Skip to content

Commit bfd7f35

Browse files
committed
ACPT-860: Indexation time is calculated incorrectly
- Compare 2 approaches;
1 parent 05a9858 commit bfd7f35

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
102102
$output->write($indexer->getTitle() . ' index ');
103103

104104
$startTime = new \DateTimeImmutable();
105+
$startTimeOriginal = microtime(true);
105106
$indexerConfig = $this->getConfig()->getIndexer($indexer->getId());
106107
$sharedIndex = $indexerConfig['shared_index'] ?? null;
107108

@@ -112,6 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
112113
$this->sharedIndexesComplete[] = $sharedIndex;
113114
}
114115
}
116+
$resultTime = microtime(true) - $startTimeOriginal;
115117
$endTime = new \DateTimeImmutable();
116118
$interval = $startTime->diff($endTime);
117119
$days = $interval->format('%d');
@@ -122,6 +124,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
122124
$output->writeln(
123125
__('has been rebuilt successfully in %1:%2:%3', $hours, $minutes, $seconds)
124126
);
127+
$output->writeln(
128+
__('%indexer index has been rebuilt successfully ORIGINALLY in %time', ['indexer' => $indexer->getTitle(), 'time' => gmdate('H:i:s', (int) $resultTime)])
129+
);
125130
} catch (\Throwable $e) {
126131
$output->writeln('process error during indexation process:');
127132
$output->writeln($e->getMessage());

0 commit comments

Comments
 (0)