| 96 | } |
| 97 | |
| 98 | type 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 |
| 140 | type TaskQueueOption func(*TaskQueue) |
nothing calls this directly
no outgoing calls
no test coverage detected