Fix processing dependency graph only onces per node

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2020-11-20 17:56:27 +01:00
parent b3f406f410
commit 98cc5cc1eb
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
1 changed files with 5 additions and 0 deletions

View File

@ -31,9 +31,13 @@ func inDependencyOrder(ctx context.Context, project *types.Project, fn func(cont
eg, ctx := errgroup.WithContext(ctx)
results := make(chan string)
errors := make(chan error)
scheduled := map[string]bool{}
for len(graph) > 0 {
for _, n := range graph.independents() {
service := n.service
if scheduled[service.Name] {
continue
}
eg.Go(func() error {
err := fn(ctx, service)
if err != nil {
@ -43,6 +47,7 @@ func inDependencyOrder(ctx context.Context, project *types.Project, fn func(cont
results <- service.Name
return nil
})
scheduled[service.Name] = true
}
select {
case result := <-results: