Commit 75ab15a2 authored by Marc Shaw's avatar Marc Shaw

Stream the Diff Stats back from Gitaly

This was causing an issue with the timing shown on the performance
  bar for this gitaly call. It was only measuring the time to make
  the call, and not the time taken to stream it back.

Issue: gitlab.com/gitlab-org/gitlab/-/issues/209786
Merge Request: gitlab.com/gitlab-org/gitlab/-/merge_requests/33606
parent f6d1e7d2
......@@ -212,8 +212,9 @@ module Gitlab
right_commit_id: right_commit_sha
)
response = GitalyClient.call(@repository.storage, :diff_service, :diff_stats, request, timeout: GitalyClient.medium_timeout)
response.flat_map(&:stats)
GitalyClient.streaming_call(@repository.storage, :diff_service, :diff_stats, request, timeout: GitalyClient.medium_timeout) do |response|
response.flat_map(&:stats)
end
end
def find_all_commits(opts = {})
......
......@@ -123,16 +123,20 @@ describe Gitlab::GitalyClient::CommitService do
describe '#diff_stats' do
let(:left_commit_id) { 'master' }
let(:right_commit_id) { 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' }
let(:response_value) { [double(stats: stat)] }
let(:stat) { double }
it 'sends an RPC request' do
it 'sends an RPC request and returns the stats' do
request = Gitaly::DiffStatsRequest.new(repository: repository_message,
left_commit_id: left_commit_id,
right_commit_id: right_commit_id)
expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:diff_stats)
.with(request, kind_of(Hash)).and_return([])
.with(request, kind_of(Hash)).and_return(response_value)
returned_value = described_class.new(repository).diff_stats(left_commit_id, right_commit_id)
described_class.new(repository).diff_stats(left_commit_id, right_commit_id)
expect(returned_value).to eq([stat])
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment