Skip to content

Commit

Permalink
fix: create subgraph when multiple roots present
Browse files Browse the repository at this point in the history
If there is more then one root present in the config
we need to create a subgraph that only includes the
Descendants of the desired root and omits the rest.
If we try to step through the initial dag instead it will
create a locking situation that will break execution.

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
  • Loading branch information
MDr164 authored and AtomicFS committed Jan 20, 2025
1 parent 402447e commit 942bc1b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/firmware-action/recipes/recipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,15 @@ func Build(
queueMutex.Unlock()
return nil, nil
}
_, err = dependencyForest.DescendantsFlow(target, nil, flowCallback)

// Create a subgraph with target as the only root
// Having multiple roots will result in miscalculation inside DescendantsFlow channel size calculation
pruned, rootID, err := dependencyForest.GetDescendantsGraph(target)
if err != nil {
return nil, err
}

_, err = pruned.DescendantsFlow(rootID, nil, flowCallback)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 942bc1b

Please sign in to comment.