diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-08 00:08:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-08 00:08:39 +0300 |
commit | 0c6bc5443aa6c8f3e4becccb89fc0f135b4c64c8 (patch) | |
tree | 55f13e752e9061c1800cce510a52fc78b13282ca /lib/gitlab/git/blob.rb | |
parent | d7ce7307dca551759ffa972015875f8ebe476927 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/git/blob.rb')
-rw-r--r-- | lib/gitlab/git/blob.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index 10df4ed72d9..5a6cc0159c6 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -13,6 +13,11 @@ module Gitlab # use load_all_data!. MAX_DATA_DISPLAY_SIZE = 10.megabytes + # The number of blobs loaded in a single Gitaly call + # When a large number of blobs requested, we'd want to fetch them in + # multiple Gitaly calls + BATCH_SIZE = 250 + # These limits are used as a heuristic to ignore files which can't be LFS # pointers. The format of these is described in # https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md#the-pointer @@ -67,7 +72,13 @@ module Gitlab # to the caller to limit the number of blobs and blob_size_limit. # def batch(repository, blob_references, blob_size_limit: MAX_DATA_DISPLAY_SIZE) - repository.gitaly_blob_client.get_blobs(blob_references, blob_size_limit).to_a + if Feature.enabled?(:blobs_fetch_in_batches, default_enabled: true) + blob_references.each_slice(BATCH_SIZE).flat_map do |refs| + repository.gitaly_blob_client.get_blobs(refs, blob_size_limit).to_a + end + else + repository.gitaly_blob_client.get_blobs(blob_references, blob_size_limit).to_a + end end # Returns an array of Blob instances just with the metadata, that means |