Skip to content

Don't call FindCommit for raw blobs

Sean McGivern requested to merge no-findcommit-for-raw-endpoints into master

Repository#blob_at can accept a reference or a SHA, so we don't need to find the commit for the reference, we can just pass it straight through.

We also make sure that Repository#blob_at doesn't try to do anything fancy with a README unless the file could be a README.

Calling FindCommit a lot can make Gitaly very sad: gitaly#3319 (closed) See the comments at gitlab-com/gl-infra/scalability#661 (comment 450955781) for more details.

To test this locally, you can use the performance bar. First, open your browser inspector (while logged in), then load a file like http://localhost:3000/root/wget2/-/raw/master/todo.txt. You can take the X-Request-Id header, click '+' in the performance bar in another tab, and then see the results:

image

For a file that could be a README, we have some special casing code, so we will still call FindCommit there:

image

For gitlab-com/gl-infra/scalability#677 (closed).

Merge request reports

Loading