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

Method NewNamedQueue

pkg/task/queue/queue_set.go:91–108  ·  view source on GitHub ↗
(name string, handler func(ctx context.Context, t task.Task) TaskResult, opts ...TaskQueueOption)

Source from the content-addressed store, hash-verified

89}
90
91func (tqs *TaskQueueSet) NewNamedQueue(name string, handler func(ctx context.Context, t task.Task) TaskResult, opts ...TaskQueueOption) {
92 q := NewTasksQueue(
93 name,
94 tqs.metricStorage,
95 WithHandler(handler),
96 WithContext(tqs.ctx),
97 )
98
99 for _, opt := range opts {
100 opt(q)
101 }
102
103 if q.logger == nil {
104 q.logger = log.NewLogger().Named("task_queue")
105 }
106
107 tqs.Queues.Set(q.Name, q)
108}
109
110func (tqs *TaskQueueSet) GetByName(name string) *TaskQueue {
111 q, ok := tqs.Queues.Get(name)

Calls 4

NewTasksQueueFunction · 0.85
WithHandlerFunction · 0.85
WithContextFunction · 0.85
SetMethod · 0.45