MCPcopy Create free account
hub / github.com/flant/shell-operator / NewTaskCounter

Function NewTaskCounter

pkg/task/queue/task_counter.go:27–39  ·  view source on GitHub ↗
(name string, countableTypes map[task.TaskType]struct{}, metricStorage metricsstorage.Storage)

Source from the content-addressed store, hash-verified

25}
26
27func NewTaskCounter(name string, countableTypes map[task.TaskType]struct{}, metricStorage metricsstorage.Storage) *TaskCounter {
28 if metricStorage == nil {
29 panic("metricStorage cannot be nil")
30 }
31
32 return &TaskCounter{
33 queueName: name,
34 counter: make(map[string]uint, 32),
35 reachedCap: make(map[string]struct{}, 32),
36 metricStorage: metricStorage,
37 countableTypes: countableTypes,
38 }
39}
40
41func (tc *TaskCounter) Add(task task.Task) {
42 tc.mu.Lock()

Callers 2

NewTasksQueueFunction · 0.85

Calls

no outgoing calls