graphqlbackend: More lazy loading of git commits
Created by: tsenart
This changeset builds on top of #15752 to extend lazy loading of git commits to these code paths:
graphqlbackend.RepositoryResolver.{Commit, CommitFromID}
graphqlbackend.NewRepositoryComparison
As per what we observed in getCommits data set in Honeycomb, most of the GraphQL queries using the gitCommitResolver
, either directly or indirectly, don't ask for information beyond the commit ID or URL, which can be constructed statically without calling out to git-server to run an expensive git log
operation.
This change also makes it so the above code paths don't trigger any lazy adding of repos that are being seen for the first time, which on sourcegraph.com wasn't happening anyways, and on customer instances isn't needed, since we know the repos we have at hand already do exist in the repo table.
This doesn't change the behaviour of ensuring a revision exists when running a git command (like git log
).
These are client calls that should see speed improvements from having at least -1 RPCs to gitserver:
- https://github.com/sourcegraph/code-intel-extensions/blob/6ac2e6dca697f6077b8021c81197427d2a9d93dc/shared/lsif/definition-hover.ts#L26
- https://github.com/sourcegraph/code-intel-extensions/blob/6ac2e6dca697f6077b8021c81197427d2a9d93dc/shared/lsif/ranges.ts#L246
- https://github.com/sourcegraph/code-intel-extensions/blob/6ac2e6dca697f6077b8021c81197427d2a9d93dc/shared/lsif/references.ts#L24
- https://github.com/sourcegraph/code-intel-extensions/blob/6ac2e6dca697f6077b8021c81197427d2a9d93dc/shared/util/api.ts#L129
- https://github.com/sourcegraph/code-intel-extensions/blob/6ac2e6dca697f6077b8021c81197427d2a9d93dc/shared/util/api.ts#L307
- https://github.com/sourcegraph/codenav-bash/blob/2ab71ff256c7c1d62a98befb88ca74fb8965c936/src/api.ts#L122
- https://github.com/sourcegraph/codenav-bash/blob/2ab71ff256c7c1d62a98befb88ca74fb8965c936/src/api.ts#L319
- https://github.com/sourcegraph/sourcegraph-eslint/blob/9e474333c7db0cdc60e94407ed75b3ad6a9c1b61/src/eslint.ts#L22
- https://github.com/sourcegraph/sourcegraph-test-leaderboard/blob/b9ccbc12052220c38fec14efea4677d3b2a4127e/src/sourcegraph-test-leaderboard.ts#L102
- https://github.com/sourcegraph/sourcegraph-test-leaderboard/blob/b9ccbc12052220c38fec14efea4677d3b2a4127e/src/sourcegraph-test-leaderboard.ts#L143
- https://github.com/sourcegraph/sourcegraph/blob/2d837e4fff632b95dabb58014af3e1b8844b28b2/client/browser/src/shared/repo/backend.tsx#L64
- https://github.com/sourcegraph/sourcegraph/blob/421ebb264118cc0b64206e8f769d1b2d7db2056f/client/browser/src/shared/repo/backend.tsx#L129
- https://github.com/sourcegraph/sourcegraph/blob/7d11c94f4fb982daf625dad34a713743440ce5a9/client/browser/src/shared/backend/diffs.tsx#L21
- https://github.com/sourcegraph/sourcegraph/blob/7d11c94f4fb982daf625dad34a713743440ce5a9/client/web/src/repo/backend.ts#L168
- https://github.com/sourcegraph/sourcegraph/blob/7d11c94f4fb982daf625dad34a713743440ce5a9/client/web/src/repo/backend.ts#L229
- https://github.com/sourcegraph/sourcegraph/blob/7d11c94f4fb982daf625dad34a713743440ce5a9/client/web/src/repo/backend.ts#L259
- https://github.com/sourcegraph/sourcegraph/blob/7d11c94f4fb982daf625dad34a713743440ce5a9/client/web/src/repo/compare/RepositoryCompareDiffPage.tsx#L31
- https://github.com/sourcegraph/sourcegraph/blob/7d11c94f4fb982daf625dad34a713743440ce5a9/client/web/src/repo/tree/TreePage.tsx#L60
These code paths are so pervasive, that this should result in a slight to significant (depending on the specific client call) performance improvement across the whole product. We'll be able to monitor the performance of these GraphQL queries with the internal dashboard checked-in with this PR (cc @bobheadxi @pecigonzalo).
This also fixes #15392 for good (for now).