From e1e0756b408067c014595016454ab76fb3d959ed Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 22 Sep 2022 16:44:01 +0500 Subject: [PATCH] seller id deadlock and delete elapsed time --- controllers/ImportController.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/ImportController.go b/controllers/ImportController.go index cfe1b16..19f2390 100644 --- a/controllers/ImportController.go +++ b/controllers/ImportController.go @@ -597,7 +597,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error { flatVariant.ProductID = sizeVariantProduct.ID - if errVariant := db.Create(&flatVariant).Error; errVariant != nil { + if errVariant := tx.Create(&flatVariant).Error; errVariant != nil { log.Println(errVariant) tx.RollbackTo(sizeSavePoint) continue @@ -851,7 +851,7 @@ func UpdateProduct(product models.Product, db *gorm.DB, productFlat gm.ProductFl } else if len(product.ColorVariants) > 0 { //todo update configurable product product.ColorVariants = append(product.ColorVariants, product) - + //tx := db.Begin() for _, colorVariant := range product.ColorVariants { if len(colorVariant.SizeVariants) > 0 {