Skip to content

Commit 1d1b6cc

Browse files
miltalexteo
authored andcommitted
[core] Fix kill tasks deadline
1 parent 86821c2 commit 1d1b6cc

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

core/task/manager.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -727,22 +727,26 @@ func (m *Manager) doKillTasks(tasks Tasks) (killed Tasks, running Tasks, err err
727727
})
728728
}))
729729

730+
// Remove from the roster the tasks we are going to kill
731+
// if we couldn't kill a task add it back to the roster
732+
m.roster.updateTasks(m.roster.filtered(func(task *Task) bool {
733+
return !tasks.Contains(func(t *Task) bool {
734+
return task.status == ACTIVE
735+
})
736+
}))
737+
730738
for _, task := range tasks.Filtered(func(task *Task) bool { return task.status == ACTIVE }) {
731739
e := m.doKillTask(task)
732740
if e != nil {
733741
log.WithError(e).WithField("taskId", task.taskId).Error("could not kill task")
734742
err = errors.New("could not kill some tasks")
743+
// task should be added back to the roster
744+
m.roster.append(task)
735745
} else {
736746
killed = append(killed, task)
737747
}
738748
}
739749

740-
// Remove from the roster the tasks we've just killed
741-
m.roster.updateTasks(m.roster.filtered(func(task *Task) bool {
742-
return !killed.Contains(func(t *Task) bool {
743-
return t.taskId == task.taskId
744-
})
745-
}))
746750
running = m.roster.getTasks()
747751

748752
return

0 commit comments

Comments
 (0)