Skip to content

Commit 9aef3e7

Browse files
committed
Improved switch table fix, let's only call it once with a unique set of table names. This should both fix the static and the integration test failures.
1 parent 4663e88 commit 9aef3e7

File tree

1 file changed

+6
-1
lines changed
  • app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action

1 file changed

+6
-1
lines changed

app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function execute($ids = null): void
148148
$entityMetadata = $this->metadataPool->getMetadata(ProductInterface::class);
149149

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

152153
/** @var DefaultStock $indexer */
153154
foreach ($this->_getTypeIndexers() as $indexer) {
@@ -199,8 +200,12 @@ public function execute($ids = null): void
199200
$connection->query($query);
200201
}
201202
}
202-
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);
203+
204+
$indexerTables[] = $indexer->getMainTable();
203205
}
206+
207+
$indexerTables = array_unique($indexerTables);
208+
$this->activeTableSwitcher->switchTable($this->_getConnection(), $indexerTables);
204209
} catch (\Exception $e) {
205210
throw new LocalizedException(__($e->getMessage()), $e);
206211
}

0 commit comments

Comments
 (0)