MCPcopy Create free account
hub / github.com/astercloud/aster / Cancel

Method Cancel

pkg/core/scheduler.go:283–301  ·  view source on GitHub ↗

Cancel 取消任务

(taskID string)

Source from the content-addressed store, hash-verified

281
282// Cancel 取消任务
283func (s *Scheduler) Cancel(taskID string) error {
284 s.mu.Lock()
285 defer s.mu.Unlock()
286
287 // 检查步骤任务
288 if _, exists := s.stepTasks[taskID]; exists {
289 delete(s.stepTasks, taskID)
290 return nil
291 }
292
293 // 检查时间间隔任务
294 if task, exists := s.intervalTasks[taskID]; exists {
295 close(task.stopCh)
296 delete(s.intervalTasks, taskID)
297 return nil
298 }
299
300 return fmt.Errorf("task not found: %s", taskID)
301}
302
303// Clear 清空所有任务
304func (s *Scheduler) Clear() {

Callers 3

TestScheduler_CancelFunction · 0.95

Calls 1

deleteFunction · 0.85

Tested by 2

TestScheduler_CancelFunction · 0.76