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

Method AddTailTasks

pkg/task/queue/queue_set.go:123–143  ·  view source on GitHub ↗
(tasks ...task.Task)

Source from the content-addressed store, hash-verified

121}
122
123func (tqs *TaskQueueSet) AddTailTasks(tasks ...task.Task) {
124 tqs.logger.Debug("AddTailTasks: adding tasks to queues", slog.Int(pkg.LogKeyTasksCount, len(tasks)))
125
126 for _, resTask := range tasks {
127 q, ok := tqs.Queues.Get(resTask.GetQueueName())
128 if ok {
129 tqs.logger.Debug("AddTailTasks: adding task to queue",
130 slog.String(pkg.LogKeyQueueName, resTask.GetQueueName()),
131 slog.String(pkg.LogKeyDescription, resTask.GetDescription()))
132 q.AddLast(resTask)
133
134 continue
135 }
136
137 log.Error("Possible bug!!! Got task for queue but queue is not created yet.",
138 slog.String(pkg.LogKeyQueueName, resTask.GetQueueName()),
139 slog.String(pkg.LogKeyDescription, resTask.GetDescription()))
140 }
141
142 tqs.logger.Debug("AddTailTasks: adding tasks to queues done")
143}
144
145// GetSnapshot returns a snapshot of all queues at the time of the call.
146// This is useful for iteration when you need to call methods on the queues

Callers

nothing calls this directly

Calls 6

GetMethod · 0.65
GetQueueNameMethod · 0.65
GetDescriptionMethod · 0.65
AddLastMethod · 0.65
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected