Reduce CommitIsAncestor RPCs with environments
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 a few environments instead of
iterating through all of them.
Closes #29562 (closed)
Edited by Stan Hu