- 优化京东门店商品信息同步逻辑,少量数据同步时,拆开,以避免由于单个SKU全体失败的情况
This commit is contained in:
@@ -32,7 +32,16 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
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) {
|
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
var skuPriceInfoList []*jdapi.SkuPriceInfo
|
var skuPriceInfoList []*jdapi.SkuPriceInfo
|
||||||
var skuVendibilityList []*jdapi.StockVendibility
|
var skuVendibilityList []*jdapi.StockVendibility
|
||||||
|
|||||||
Reference in New Issue
Block a user