prune unused providers from the graph, again

The provider transformers remove extra provider nodes when they are
initially setup, but it may turn out that they are not used later on.

The pruneUnusedNodesTransformer takes care of removing unused expansion
nodes, which originally required a provider, and hence may cause some
provider nodes to no longer be needed. We can also detect these and
remove them during the pruneUnusedNodesTransformer process.
This commit is contained in:
James Bardin 2021-03-08 14:52:43 -05:00
parent 7674e19d4e
commit 58b085f0dc
1 changed files with 7 additions and 0 deletions

View File

@ -221,6 +221,13 @@ func (t *pruneUnusedNodesTransformer) Transform(g *Graph) error {
}
}
case GraphNodeProvider:
// Providers that may have been required by expansion nodes
// that we no longer need can also be removed.
if g.UpEdges(n).Len() > 0 {
return
}
default:
return
}