diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-11-23 14:26:17 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-11-26 13:15:18 +0300 |
commit | 5f0e4040ce7d4d0019b3340dd603cc6f67dd036d (patch) | |
tree | 76fb16a30e6ea702ecc14164e9b1c4d277ac1920 /spec/lib/gitlab/git/commit_spec.rb | |
parent | ba9eeea4ee2eb3a43cc3d107a2590a6227af89ed (diff) |
Batch load only data from same repository when lazy object is accessed
By specifying `key`, we get a different lazy batch loader for each
repository, which means that accessing a lazy object from one repository
will only result in that repository's objects being fetched, not those
of other repositories, saving us some unnecessary Gitaly lookups.
Diffstat (limited to 'spec/lib/gitlab/git/commit_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git/commit_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb index 74d542060d5..db68062e433 100644 --- a/spec/lib/gitlab/git/commit_spec.rb +++ b/spec/lib/gitlab/git/commit_spec.rb @@ -450,11 +450,17 @@ describe Gitlab::Git::Commit, :seed_helper do described_class.extract_signature_lazily(repository, commit_id) end + other_repository = double(:repository) + described_class.extract_signature_lazily(other_repository, commit_ids.first) + expect(described_class).to receive(:batch_signature_extraction) .with(repository, commit_ids) .once .and_return({}) + expect(described_class).not_to receive(:batch_signature_extraction) + .with(other_repository, commit_ids.first) + 2.times { signatures.each(&:itself) } end end |