同步错误返回

This commit is contained in:
苏尹岚
2019-11-26 11:27:52 +08:00
parent 483d3c8dbc
commit d69ad7a9e4
4 changed files with 10 additions and 8 deletions

View File

@@ -66,6 +66,7 @@ type ITask interface {
AddErrMsg(failedList ...interface{})
GetErrMsg() (failedList []interface{})
SetFinishHook(func(task ITask))
GetFinishHook() func(task ITask)
json.Marshaler
}
@@ -229,6 +230,10 @@ func (t *BaseTask) GetTotalJobCount() int {
return t.TotalJobCount
}
func (t *BaseTask) GetFinishHook() func(ITask) {
return t.FinishHook
}
func (t *BaseTask) GetFinishedJobCount() int {
t.locker.RLock()
defer t.locker.RUnlock()
@@ -474,7 +479,7 @@ func (t *BaseTask) run(taskHandler func()) {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "异步任务完成", content)
}
}
t.SetFinishHook(t.FinishHook)
t.GetFinishHook()
})
}
}