MCPcopy Create free account
hub / github.com/devfeel/dottask / RemoveTask

Method RemoveTask

tasks.go:272–286  ·  view source on GitHub ↗

RemoveTask remove task by taskid

(taskID string)

Source from the content-addressed store, hash-verified

270
271// RemoveTask remove task by taskid
272func (service *TaskService) RemoveTask(taskID string) {
273 //1.stop task running
274 t, isExists := service.GetTask(taskID)
275 if !isExists {
276 return
277 }
278 t.Stop()
279 service.Logger().Info(fmt.Sprint("Task:RemoveTask::StopTask => ", taskID))
280
281 //2.delete task from taskMap
282 service.taskMutex.Lock()
283 delete(service.taskMap, taskID)
284 service.taskMutex.Unlock()
285 service.Logger().Info(fmt.Sprint("Task:RemoveTask => ", taskID))
286}
287
288// Count get all task's count
289func (service *TaskService) Count() int {

Callers 1

mainFunction · 0.80

Calls 4

GetTaskMethod · 0.95
LoggerMethod · 0.95
StopMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected