ListTasks 列出所有任务
()
| 302 | |
| 303 | // ListTasks 列出所有任务 |
| 304 | func (tm *FileTaskManager) ListTasks() ([]*TaskInfo, error) { |
| 305 | tm.mu.RLock() |
| 306 | defer tm.mu.RUnlock() |
| 307 | |
| 308 | tasks := make([]*TaskInfo, 0, len(tm.tasks)) |
| 309 | for _, task := range tm.tasks { |
| 310 | // 更新运行中任务的状态 |
| 311 | if task.Status == "running" { |
| 312 | tm.updateTaskStatus(task) |
| 313 | } |
| 314 | tasks = append(tasks, task) |
| 315 | } |
| 316 | |
| 317 | return tasks, nil |
| 318 | } |
| 319 | |
| 320 | // GetTaskStatus 获取任务状态 |
| 321 | func (tm *FileTaskManager) GetTaskStatus(taskID string) (string, error) { |
nothing calls this directly
no test coverage detected