Skip to content

Commit

Permalink
Ensure "temporary" table is always dropped after indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
aligent-lturner committed Nov 17, 2024
1 parent 58a2c8f commit 3cf2a53
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/index/Model/ProductIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,20 @@ public function executeList(array $ids): void
// create temporary table to handle changelogs
$this->tempTable->generateTempTableName();
$this->tempTable->create();
foreach ($this->dimensionProvider->getIterator() as $dimension) {
try {
$this->executeByDimensions($dimension, new \ArrayIterator($ids));
} catch (FileSystemException|RuntimeException) {
continue;
// try block here is nested to ensure that if the table was created, it gets dropped at the end
try {
foreach ($this->dimensionProvider->getIterator() as $dimension) {
try {
$this->executeByDimensions($dimension, new \ArrayIterator($ids));
} catch (FileSystemException|RuntimeException) {
continue;
}
}
$this->insertChangelogRecords->execute();
} finally {
// we want to ensure that the "temporary" table is always dropped
$this->tempTable->drop();
}
$this->insertChangelogRecords->execute();
$this->tempTable->drop();
} catch (\Exception $e) {
$this->logger->critical($e->getMessage(), ['exception' => $e]);
}
Expand Down

0 comments on commit 3cf2a53

Please sign in to comment.