From 5f2415c8a5bb3eb492119636582d06dac0ed771e Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 9 Sep 2019 17:40:08 +0800 Subject: [PATCH] =?UTF-8?q?-=20PruneMissingStoreSkus=E4=B8=AD=E6=94=B9?= =?UTF-8?q?=E7=94=A8NewParallelTask?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync_store_sku.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 54dec9cdc..374999657 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -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()