Skip to content

Commit

Permalink
Improved switch table fix, let's only call it once with a unique set …
Browse files Browse the repository at this point in the history
…of table names. This should both fix the static and the integration test failures.
  • Loading branch information
hostep committed Apr 17, 2024
1 parent d7cd905 commit 105ef98
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public function execute($ids = null): void
$entityMetadata = $this->metadataPool->getMetadata(ProductInterface::class);

$columns = array_keys($this->_getConnection()->describeTable($this->_getIdxTable()));
$indexerTables = [];

/** @var DefaultStock $indexer */
foreach ($this->_getTypeIndexers() as $indexer) {
Expand Down Expand Up @@ -199,8 +200,12 @@ public function execute($ids = null): void
$connection->query($query);
}
}
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);

$indexerTables[] = $indexer->getMainTable();
}

$indexerTables = array_unique($indexerTables);
$this->activeTableSwitcher->switchTable($this->_getConnection(), $indexerTables);
} catch (\Exception $e) {
throw new LocalizedException(__($e->getMessage()), $e);
}
Expand Down

0 comments on commit 105ef98

Please sign in to comment.