chore: cancel task while wait for worker

refactor/fs
Noah Hsu 2022-06-29 22:06:56 +08:00
parent fd55f2cbfa
commit e614faa99b
1 changed files with 3 additions and 0 deletions

View File

@ -32,6 +32,9 @@ func (tm *Manager[K]) do(task *Task[K]) {
log.Debugf("task [%s] starting", task.Name)
task.run()
log.Debugf("task [%s] ended", task.Name)
case <-task.Ctx.Done():
log.Debugf("task [%s] canceled", task.Name)
return
}
// return worker
tm.workerC <- struct{}{}