MCPcopy
hub / github.com/docker/compose / run

Method run

pkg/compose/dependencies.go:167–192  ·  view source on GitHub ↗

Note: this could be `graph.walk` or whatever

(ctx context.Context, graph *Graph, eg *errgroup.Group, nodes []*Vertex, nodeCh chan *Vertex)

Source from the content-addressed store, hash-verified

165
166// Note: this could be `graph.walk` or whatever
167func (t *graphTraversal) run(ctx context.Context, graph *Graph, eg *errgroup.Group, nodes []*Vertex, nodeCh chan *Vertex) {
168 for _, node := range nodes {
169 // Don't start this service yet if all of its children have
170 // not been started yet.
171 if len(t.filterAdjacentByStatusFn(graph, node.Key, t.adjacentServiceStatusToSkip)) != 0 {
172 continue
173 }
174
175 if !t.consume(node.Key) {
176 // another worker already visited this node
177 continue
178 }
179
180 eg.Go(func() error {
181 var err error
182 if _, ignore := t.ignored[node.Service]; !ignore {
183 err = t.visitorFn(ctx, node.Service)
184 }
185 if err == nil {
186 graph.UpdateStatus(node.Key, t.targetServiceStatus)
187 }
188 nodeCh <- node
189 return err
190 })
191 }
192}
193
194func (t *graphTraversal) consume(nodeKey string) bool {
195 t.mu.Lock()

Callers 1

visitMethod · 0.95

Calls 2

consumeMethod · 0.95
UpdateStatusMethod · 0.80

Tested by

no test coverage detected