- 门店爬虫添加调试信息
This commit is contained in:
@@ -29,6 +29,7 @@ func GetCityShops(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []
|
|||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
retVal = storeList
|
retVal = storeList
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("GetCityShops vendorID:%d, cityCode:%d, len(storeList):%d, err:%v", vendorID, cityCode, len(storeList), err)
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, vendorIDs)
|
}, vendorIDs)
|
||||||
tasksch.AddChild(parentTask, task).Run()
|
tasksch.AddChild(parentTask, task).Run()
|
||||||
@@ -124,11 +125,13 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
|||||||
task := tasksch.NewSeqTask("GetAndStoreCitiesShops", ctx,
|
task := tasksch.NewSeqTask("GetAndStoreCitiesShops", ctx,
|
||||||
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||||
cityCode := cityCodeList[step]
|
cityCode := cityCodeList[step]
|
||||||
|
globals.SugarLogger.Debugf("process city:%d", cityCode)
|
||||||
shopList, err := GetCityShops(ctx, task, vendorIDs, cityCode, radius, gridWith)
|
shopList, err := GetCityShops(ctx, task, vendorIDs, cityCode, radius, gridWith)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
panic(r)
|
||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -145,6 +148,7 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
|||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("process city:%d, len(shopList):%d, err:%v", cityCode, len(shopList), err)
|
||||||
return nil, nil // 强制继续
|
return nil, nil // 强制继续
|
||||||
}, len(cityCodeList))
|
}, len(cityCodeList))
|
||||||
tasksch.ManageTask(task).Run()
|
tasksch.ManageTask(task).Run()
|
||||||
|
|||||||
Reference in New Issue
Block a user