同步错误返回
This commit is contained in:
@@ -65,7 +65,7 @@ type ITask interface {
|
||||
AddBatchErr(err error)
|
||||
AddErrMsg(failedList ...interface{})
|
||||
GetErrMsg() (failedList []interface{})
|
||||
SetFinishHook(func(task ITask, ctx *jxcontext.Context))
|
||||
SetFinishHook(func(task ITask))
|
||||
json.Marshaler
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ type BaseTask struct {
|
||||
ctx *jxcontext.Context
|
||||
isGetResultCalled bool
|
||||
FailedList []interface{}
|
||||
finishHook func(task ITask, ctx *jxcontext.Context)
|
||||
finishHook func(task ITask)
|
||||
}
|
||||
|
||||
func (s TaskList) Len() int {
|
||||
@@ -362,7 +362,7 @@ func (t *BaseTask) Error() (errMsg string) {
|
||||
return errMsg
|
||||
}
|
||||
|
||||
func (t *BaseTask) SetFinishHook(hook func(task ITask, ctx *jxcontext.Context)) {
|
||||
func (t *BaseTask) SetFinishHook(hook func(task ITask)) {
|
||||
t.locker.RLock()
|
||||
defer t.locker.RUnlock()
|
||||
t.finishHook = hook
|
||||
@@ -450,7 +450,7 @@ func (t *BaseTask) run(taskHandler func()) {
|
||||
}
|
||||
close(t.finishChan)
|
||||
if t.finishHook != nil {
|
||||
t.finishHook(t, t.ctx)
|
||||
t.finishHook(t)
|
||||
} else {
|
||||
SendMessage(t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user