Merge pull request 'fix tasklist bugs' (#193) from tzwang/pcm-coordinator:master into master
Former-commit-id: 2bec5f413ef99876cf7f4e9eca32a441315d0c88
This commit is contained in:
commit
3f4d8924d8
|
@ -85,24 +85,25 @@ func (l *PageListTaskLogic) PageListTask(req *types.PageTaskReq) (resp *types.Pa
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<- struct{}) {
|
func (l *PageListTaskLogic) updateTaskStatus(tasklist []*types.TaskModel, ch chan<- struct{}) {
|
||||||
for i := len(tasks) - 1; i >= 0; i-- {
|
list := tasklist
|
||||||
if tasks[i].AdapterTypeDict != 1 || tasks[i].Status == constants.Succeeded || tasks[i].Status == constants.Failed {
|
for i := len(list) - 1; i >= 0; i-- {
|
||||||
tasks = append(tasks[:i], tasks[i+1:]...)
|
if list[i].AdapterTypeDict != 1 || list[i].Status == constants.Succeeded || list[i].Status == constants.Failed {
|
||||||
|
list = append(list[:i], list[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(tasks) == 0 {
|
if len(list) == 0 {
|
||||||
ch <- struct{}{}
|
ch <- struct{}{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
task := tasks[0]
|
task := list[0]
|
||||||
for i, _ := range tasks {
|
for i, _ := range list {
|
||||||
earliest, _ := time.Parse(constants.Layout, task.UpdatedTime)
|
earliest, _ := time.Parse(constants.Layout, task.UpdatedTime)
|
||||||
latest, _ := time.Parse(constants.Layout, tasks[i].UpdatedTime)
|
latest, _ := time.Parse(constants.Layout, list[i].UpdatedTime)
|
||||||
if latest.Before(earliest) {
|
if latest.Before(earliest) {
|
||||||
task = tasks[i]
|
task = list[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,24 +207,25 @@ func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<-
|
||||||
ch <- struct{}{}
|
ch <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *PageListTaskLogic) updateAiTaskStatus(tasks []*types.TaskModel, ch chan<- struct{}) {
|
func (l *PageListTaskLogic) updateAiTaskStatus(tasklist []*types.TaskModel, ch chan<- struct{}) {
|
||||||
for i := len(tasks) - 1; i >= 0; i-- {
|
list := tasklist
|
||||||
if tasks[i].AdapterTypeDict != 1 || tasks[i].Status == constants.Succeeded || tasks[i].Status == constants.Failed {
|
for i := len(list) - 1; i >= 0; i-- {
|
||||||
tasks = append(tasks[:i], tasks[i+1:]...)
|
if list[i].AdapterTypeDict != 1 || list[i].Status == constants.Succeeded || list[i].Status == constants.Failed {
|
||||||
|
list = append(list[:i], list[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(tasks) == 0 {
|
if len(list) == 0 {
|
||||||
ch <- struct{}{}
|
ch <- struct{}{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
task := tasks[0]
|
task := list[0]
|
||||||
for i, _ := range tasks {
|
for i, _ := range list {
|
||||||
earliest, _ := time.Parse(constants.Layout, task.UpdatedTime)
|
earliest, _ := time.Parse(constants.Layout, task.UpdatedTime)
|
||||||
latest, _ := time.Parse(constants.Layout, tasks[i].UpdatedTime)
|
latest, _ := time.Parse(constants.Layout, list[i].UpdatedTime)
|
||||||
if latest.Before(earliest) {
|
if latest.Before(earliest) {
|
||||||
task = tasks[i]
|
task = list[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue