• Stan Hu's avatar
    Reduce CommitIsAncestor RPCs with environments · d016aa6a
    Stan Hu authored
    When there are many environments, loading diffs, blobs, and comparisons
    can be slow because we load many environments and call CommitIsAncestor
    on each of them to determine whether each environment is relevant to a
    given commit SHA. This is a bit of a waste because in most cases, the
    controller just needs the latest environment for the given commit.
    
    This commit adds a `find_latest` flag to `EnvironmentsFinder` to look
    for only one environment that matches the criteria. In the common case,
    we will only need to look for one or two environments instead of
    iterating through all of them.
    
    Closes https://gitlab.com/gitlab-org/gitlab/issues/29562
    d016aa6a
environment.rb 7.92 KB