2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 新增僵尸任务清理函数

This commit is contained in:
2025-08-22 22:55:09 +08:00
parent 5378072c2c
commit 81da14d615
2 changed files with 8 additions and 0 deletions

View File

@@ -73,3 +73,10 @@ func (r *taskRepo) Push(task *biz.Task) error {
task.ID,
})
}
func (r *taskRepo) ClearZombieTasks() error {
if err := r.db.Model(&biz.Task{}).Where("status = ? or status = ?", biz.TaskStatusRunning, biz.TaskStatusWaiting).Update("status", biz.TaskStatusFailed).Error; err != nil {
return err
}
return nil
}