fix: resolve task timeout bug and refactor remote executor wait logic

- Prevent hardcoded 30-minute timeout when timeout is set to 0.
- Fix zombie processes by actively stopping tasks during deletion.
- Refactor remote execution wait logic to properly handle ctx.Done() and agent disconnections.
This commit is contained in:
duorameng
2026-06-12 17:00:55 +08:00
parent 626d20c9b8
commit 5626873454
3 changed files with 74 additions and 29 deletions
+3
View File
@@ -362,6 +362,7 @@ func (tc *TaskController) DeleteTask(c *gin.Context) {
}
tc.executorService.RemoveCronTask(id)
tc.executorService.GetScheduler().StopTask(id)
success := tc.taskService.DeleteTask(id)
if !success {
@@ -460,6 +461,7 @@ func (tc *TaskController) BatchDeleteTasks(c *gin.Context) {
// 移除 cron 调度
tc.executorService.RemoveCronTask(id)
tc.executorService.GetScheduler().StopTask(id)
}
// 执行批量删除
@@ -513,6 +515,7 @@ func (tc *TaskController) BatchDeleteByQuery(c *gin.Context) {
}
// 移除 cron 调度
tc.executorService.RemoveCronTask(task.ID)
tc.executorService.GetScheduler().StopTask(task.ID)
}
// 执行批量删除