- PruneMissingStoreSkus中改用NewParallelTask

This commit is contained in:
gazebo
2019-09-09 17:40:08 +08:00
parent cf6bd1d5ea
commit 5f2415c8a5

View File

@@ -566,8 +566,10 @@ func PruneMissingStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, ven
var sku2Delete []*partner.StoreSkuInfo
var cat2Delete []*partner.BareCategoryInfo
task := tasksch.NewSeqTask(fmt.Sprintf("清除平台:%s上多余的门店商品", model.VendorChineseNames[vendorID]), ctx,
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
task := tasksch.NewParallelTask(fmt.Sprintf("清除平台:%s上多余的门店商品", model.VendorChineseNames[vendorID]),
tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
step := batchItemList[0].(int)
switch step {
case 0:
localSkuList, err := dao.GetStoreSkus2(db, vendorID, storeID, nil, false)
@@ -637,7 +639,7 @@ func PruneMissingStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, ven
cat2Delete = nil
}
return nil, err
}, 4)
}, []int{0, 1, 2, 3})
tasksch.HandleTask(task, parentTask, true).Run()
if isAsync {
hint = task.GetID()