diff --git a/business/partner/purchase/jd/store_sku.go b/business/partner/purchase/jd/store_sku.go index 352864e40..10a6e9e4b 100644 --- a/business/partner/purchase/jd/store_sku.go +++ b/business/partner/purchase/jd/store_sku.go @@ -32,7 +32,16 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks if err != nil { return "", err } - task := tasksch.NewParallelTask("syncStoreSkus京东", tasksch.NewParallelConfig().SetBatchSize(jdapi.MaxStoreSkuBatchSize).SetIsContinueWhenError(isContinueWhenError), ctx, + batchSize := jdapi.MaxStoreSkuBatchSize + storeSkusLen := len(storeSkus) + if storeSkusLen < jdapi.MaxStoreSkuBatchSize*2 { + batchSize = (storeSkusLen + 2) / 3 + } else if storeSkusLen < jdapi.MaxStoreSkuBatchSize { + batchSize = (storeSkusLen + 1) / 2 + } else if storeSkusLen < jdapi.MaxStoreSkuBatchSize/2 { + batchSize = 1 + } + task := tasksch.NewParallelTask("syncStoreSkus京东", tasksch.NewParallelConfig().SetBatchSize(batchSize).SetIsContinueWhenError(isContinueWhenError), ctx, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { var skuPriceInfoList []*jdapi.SkuPriceInfo var skuVendibilityList []*jdapi.StockVendibility