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

Struct TaskQueue

pkg/task/queue/task_queue.go:98–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98type TaskQueue struct {
99 logger *log.Logger
100
101 m sync.RWMutex
102 metricStorage metricsstorage.Storage
103 ctx context.Context
104 cancel context.CancelFunc
105
106 waitInProgress atomic.Bool
107 cancelDelay atomic.Bool
108
109 storage *TaskStorage
110
111 started atomic.Bool // a flag to ignore multiple starts
112
113 Name string
114 Handler func(ctx context.Context, t task.Task) TaskResult
115 status *TaskQueueStatus
116
117 measureActionFn func()
118 measureActionFnOnce sync.Once
119
120 // Timing settings.
121 WaitLoopCheckInterval time.Duration
122 DelayOnQueueIsEmpty time.Duration
123 DelayOnRepeat time.Duration
124 ExponentialBackoffFn func(failureCount int) time.Duration
125
126 // Compaction
127 compactionCallback func(compactedTasks []task.Task, targetTask task.Task)
128
129 compactableTypes map[task.TaskType]struct{}
130
131 queueTasksCounter *TaskCounter
132
133 // Pre-allocated buffers for compaction
134 contextBuffer []bindingcontext.BindingContext
135 monitorIDBuffer []string
136 groupBuffer map[string]*compactionGroup
137}
138
139// TaskQueueOption defines a functional option for TaskQueue configuration
140type TaskQueueOption func(*TaskQueue)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected