Skip to content

Commit b8f6a3a

Browse files
committed
#23429 wrap url rewrite regeneration into transaction
1 parent d80ef8f commit b8f6a3a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ private function prepareUniqueEntities(array $urls): array
266266
*/
267267
protected function doReplace(array $urls)
268268
{
269+
$this->connection->beginTransaction();
270+
269271
$this->deleteOldUrls($urls);
270272

271273
$data = [];
@@ -274,7 +276,11 @@ protected function doReplace(array $urls)
274276
}
275277
try {
276278
$this->insertMultiple($data);
279+
280+
$this->connection->commit();
277281
} catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
282+
$this->connection->rollBack();
283+
278284
/** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] $urlConflicted */
279285
$urlConflicted = [];
280286
foreach ($urls as $url) {

0 commit comments

Comments
 (0)