Commit c00a1ec0 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg Committed by James Lopez

Only allow 30 RPCs per test case to Gitaly

Prior to this change, 35 Gitaly RPCs were allowed. But recently there's
been a renewed interest in performance. By lowering the number of
calls new N + 1's will pop up.

Later commits will add blocks to ignore the raised errors, followed by
an issue for each to be fixed.
parent b569e76c
...@@ -40,11 +40,14 @@ module Network ...@@ -40,11 +40,14 @@ module Network
# Get commits from repository # Get commits from repository
# #
def collect_commits def collect_commits
# https://gitlab.com/gitlab-org/gitlab-ce/issues/58013
Gitlab::GitalyClient.allow_n_plus_1_calls do
find_commits(count_to_display_commit_in_center).map do |commit| find_commits(count_to_display_commit_in_center).map do |commit|
# Decorate with app/model/network/commit.rb # Decorate with app/model/network/commit.rb
Network::Commit.new(commit) Network::Commit.new(commit)
end end
end end
end
# Method is adding time and space on the # Method is adding time and space on the
# list of commits. As well as returns date list # list of commits. As well as returns date list
......
...@@ -150,8 +150,11 @@ module Banzai ...@@ -150,8 +150,11 @@ module Banzai
end end
def uri_type(path) def uri_type(path)
# https://gitlab.com/gitlab-org/gitlab-ce/issues/58011
Gitlab::GitalyClient.allow_n_plus_1_calls do
@uri_types[path] ||= current_commit.uri_type(path) @uri_types[path] ||= current_commit.uri_type(path)
end end
end
def current_commit def current_commit
@current_commit ||= context[:commit] || repository.commit(ref) @current_commit ||= context[:commit] || repository.commit(ref)
......
...@@ -28,7 +28,7 @@ module Gitlab ...@@ -28,7 +28,7 @@ module Gitlab
PEM_REGEX = /\-+BEGIN CERTIFICATE\-+.+?\-+END CERTIFICATE\-+/m PEM_REGEX = /\-+BEGIN CERTIFICATE\-+.+?\-+END CERTIFICATE\-+/m
SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION' SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION'
MAXIMUM_GITALY_CALLS = 35 MAXIMUM_GITALY_CALLS = 30
CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze
MUTEX = Mutex.new MUTEX = Mutex.new
......
...@@ -280,7 +280,10 @@ module Gitlab ...@@ -280,7 +280,10 @@ module Gitlab
# add_namespace("default", "gitlab") # add_namespace("default", "gitlab")
# #
def add_namespace(storage, name) def add_namespace(storage, name)
# https://gitlab.com/gitlab-org/gitlab-ce/issues/58012
Gitlab::GitalyClient.allow_n_plus_1_calls do
Gitlab::GitalyClient::NamespaceService.new(storage).add(name) Gitlab::GitalyClient::NamespaceService.new(storage).add(name)
end
rescue GRPC::InvalidArgument => e rescue GRPC::InvalidArgument => e
raise ArgumentError, e.message raise ArgumentError, e.message
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