- miss use err: in SyncSku

This commit is contained in:
gazebo
2018-09-21 16:57:34 +08:00
parent d74f47a1e6
commit 7295c16367
2 changed files with 7 additions and 3 deletions

View File

@@ -106,7 +106,8 @@ func (v *VendorSync) SyncSku(db *dao.DaoDB, nameID, skuID int, isForce bool, use
if skuID != -1 {
cond[model.FieldID] = skuID
}
if err := dao.GetEntitiesByKV(db, &skuList, cond, true); err == nil {
err := dao.GetEntitiesByKV(db, &skuList, cond, true)
if err == nil {
globals.SugarLogger.Debug(utils.Format4Output(skuList, false))
task := tasksch.RunTask("SyncSku", func(batchItemList []interface{}, params ...interface{}) (interface{}, error) {
sku := batchItemList[0].(*model.Sku)

View File

@@ -125,7 +125,9 @@ func RunTask(taskName string, worker WorkFunc, resultHandler ResultHandlerFunc,
}
end:
// globals.SugarLogger.Debugf("RunTask %s, put to chann chanRetVal:%v", taskName, chanRetVal)
task.subFinishChan <- chanRetVal
if task.GetStatus() < TaskStatusEndBegin {
task.subFinishChan <- chanRetVal
}
}()
}
for _, job := range jobList {
@@ -142,6 +144,7 @@ func RunTask(taskName string, worker WorkFunc, resultHandler ResultHandlerFunc,
if err2, ok := result.(error); ok {
taskResult = nil
taskErr = err2
break
} else if result != nil {
resultList := result.([]interface{})
taskResult = append(taskResult, resultList...)
@@ -162,8 +165,8 @@ func RunTask(taskName string, worker WorkFunc, resultHandler ResultHandlerFunc,
task.err = taskErr
task.result = taskResult
task.TerminatedAt = time.Now()
task.locker.Unlock()
globals.SugarLogger.Debugf("RunTask %s, result:%v, err:%v", taskName, taskResult, taskErr)
close(task.finishChan)