- use utils.CallFuncAsync when possible.

This commit is contained in:
gazebo
2018-10-20 12:02:52 +08:00
parent 2308abb775
commit 2bfa5fe17f
4 changed files with 14 additions and 8 deletions

View File

@@ -107,7 +107,7 @@ func (m *DurableTaskMan) StartTask(taskID string) error {
d := m.tasks[taskID]
if d.cmdChan == nil {
d.cmdChan = make(chan string)
go func() {
utils.CallFuncAsync(func() {
failedItemCount := 0
for _, taskItem := range d.items {
if taskItem.Status == 0 {
@@ -137,7 +137,7 @@ func (m *DurableTaskMan) StartTask(taskID string) error {
d.data.UpdatedAt = d.data.FinishedAt
dao.UpdateEntity(nil, d.data, "Status", "FinishedAt", "UpdatedAt")
}
}()
})
return nil
}
return errors.New("任务已经启动")