MCPcopy Index your code
hub / github.com/flant/shell-operator / DeleteFunc

Method DeleteFunc

pkg/task/queue/task_queue.go:1085–1100  ·  view source on GitHub ↗

DeleteFunc runs fn on every task and removes each task for which fn returns false.

(fn func(task.Task) bool)

Source from the content-addressed store, hash-verified

1083
1084// DeleteFunc runs fn on every task and removes each task for which fn returns false.
1085func (q *TaskQueue) DeleteFunc(fn func(task.Task) bool) {
1086 if fn == nil {
1087 return
1088 }
1089
1090 defer q.MeasureActionTime("DeleteFunc")()
1091
1092 q.storage.DeleteFunc(func(t task.Task) bool {
1093 if !fn(t) {
1094 q.queueTasksCounter.Remove(t)
1095 return false
1096 }
1097
1098 return true
1099 })
1100}
1101
1102// TODO define mapping method with QueueAction to insert, modify and delete tasks.
1103

Calls 2

MeasureActionTimeMethod · 0.95
RemoveMethod · 0.65