(name string, countableTypes map[task.TaskType]struct{}, metricStorage metricsstorage.Storage)
| 25 | } |
| 26 | |
| 27 | func 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 | |
| 41 | func (tc *TaskCounter) Add(task task.Task) { |
| 42 | tc.mu.Lock() |
no outgoing calls