- fix possible transaction bug in UpdateStore
This commit is contained in:
@@ -262,10 +262,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
db := dao.GetDB()
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db)
|
||||
panic(r)
|
||||
}
|
||||
dao.Rollback(db)
|
||||
}()
|
||||
if num, err = dao.UpdateEntityLogically(db, store, valid, userName, nil); err == nil && num == 1 {
|
||||
dummy := &model.StoreMap{}
|
||||
@@ -277,9 +274,6 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
_, err = CurVendorSync.SyncStore(ctx, db, -1, store.ID, false, userName)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
}
|
||||
}
|
||||
return num, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user