Commit ba0e7fd9 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Merge branch 'sh-fix-gitaly-conflicts-service-duration' into 'master'

Fix Gitaly duration timings for conflict and search RPCs

See merge request gitlab-org/gitlab!34909
parents 5651fa26 046295d3
---
title: Fix Gitaly duration timings for conflicts and search RPCs
merge_request: 34909
author:
type: other
...@@ -20,9 +20,9 @@ module Gitlab ...@@ -20,9 +20,9 @@ module Gitlab
our_commit_oid: @our_commit_oid, our_commit_oid: @our_commit_oid,
their_commit_oid: @their_commit_oid their_commit_oid: @their_commit_oid
) )
response = GitalyClient.call(@repository.storage, :conflicts_service, :list_conflict_files, request, timeout: GitalyClient.long_timeout) GitalyClient.streaming_call(@repository.storage, :conflicts_service, :list_conflict_files, request, timeout: GitalyClient.long_timeout) do |response|
GitalyClient::ConflictFilesStitcher.new(response, @gitaly_repo)
GitalyClient::ConflictFilesStitcher.new(response, @gitaly_repo) end
end end
def conflicts? def conflicts?
......
...@@ -334,9 +334,9 @@ module Gitlab ...@@ -334,9 +334,9 @@ module Gitlab
def search_files_by_content(ref, query, options = {}) def search_files_by_content(ref, query, options = {})
request = Gitaly::SearchFilesByContentRequest.new(repository: @gitaly_repo, ref: ref, query: query) request = Gitaly::SearchFilesByContentRequest.new(repository: @gitaly_repo, ref: ref, query: query)
response = GitalyClient.call(@storage, :repository_service, :search_files_by_content, request, timeout: GitalyClient.default_timeout) GitalyClient.streaming_call(@storage, :repository_service, :search_files_by_content, request, timeout: GitalyClient.default_timeout) do |response|
search_results_from_response(response, options)
search_results_from_response(response, options) end
end end
def disconnect_alternates def disconnect_alternates
...@@ -403,14 +403,18 @@ module Gitlab ...@@ -403,14 +403,18 @@ module Gitlab
def gitaly_fetch_stream_to_file(save_path, rpc_name, request_class, timeout) def gitaly_fetch_stream_to_file(save_path, rpc_name, request_class, timeout)
request = request_class.new(repository: @gitaly_repo) request = request_class.new(repository: @gitaly_repo)
response = GitalyClient.call( GitalyClient.streaming_call(
@storage, @storage,
:repository_service, :repository_service,
rpc_name, rpc_name,
request, request,
timeout: timeout timeout: timeout
) ) do |response|
write_stream_to_file(response, save_path)
end
end
def write_stream_to_file(response, save_path)
File.open(save_path, 'wb') do |f| File.open(save_path, 'wb') do |f|
response.each do |message| response.each do |message|
f.write(message.data) f.write(message.data)
......
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