Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce redundant walks when resolving module depends_on #35157

Merged
merged 2 commits into from
May 15, 2024

Commits on May 14, 2024

  1. make Ancestors and Descendents variadic

    A walk can start from multiple roots, so making the Ancestors and
    Descendents methods variadic is the easiest way to add access to that
    via the API with no changes in existing callers. We can use this from
    terraform to avoid repeatedly walking overlapping sets of nodes.
    jbardin committed May 14, 2024
    Configuration menu
    Copy the full SHA
    d3b1586 View commit details
    Browse the repository at this point in the history
  2. walk multiple ancestors at once in ReferenceMap

    The existing implementation of parentModuleDependsOn would walk each
    reference separately, but if there were many dependencies which were all
    interconnected, that would end up walking over the same nodes multiple
    times, and storing many duplicate results.
    
    Since a graph walk can start at multiple nodes, we use the extended
    version of Ancestors to start at all dependencies simultaneously,
    reducing the time spend traversing the graph as well as automatically
    removing duplicates.
    jbardin committed May 14, 2024
    Configuration menu
    Copy the full SHA
    f41a1fb View commit details
    Browse the repository at this point in the history