- BaseTask.GetResult中成功返回结果后,结果在任务中会被删除(以免被管理的任务不必要的HOLD住对象)
This commit is contained in:
@@ -169,6 +169,7 @@ func (t *BaseTask) GetID() string {
|
|||||||
return t.ID
|
return t.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 此函数成功返回结果后,结果在任务中会被删除(以免被管理的任务不必要的HOLD住对象)
|
||||||
func (t *BaseTask) GetResult(duration time.Duration) (retVal []interface{}, err error) {
|
func (t *BaseTask) GetResult(duration time.Duration) (retVal []interface{}, err error) {
|
||||||
if t.GetStatus() >= TaskStatusEndBegin {
|
if t.GetStatus() >= TaskStatusEndBegin {
|
||||||
return t.getResult(), t.GetErr()
|
return t.getResult(), t.GetErr()
|
||||||
@@ -279,10 +280,12 @@ func (t *BaseTask) GetNoticeMsg() string {
|
|||||||
return t.NoticeMsg
|
return t.NoticeMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *BaseTask) getResult() []interface{} {
|
func (t *BaseTask) getResult() (result []interface{}) {
|
||||||
t.locker.RLock()
|
t.locker.Lock()
|
||||||
defer t.locker.RUnlock()
|
defer t.locker.Unlock()
|
||||||
return t.Result
|
result = t.Result
|
||||||
|
t.Result = nil
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *BaseTask) AddBatchErr(err error) {
|
func (t *BaseTask) AddBatchErr(err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user