diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-02-22 17:51:27 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-02-22 17:51:27 +0300 |
commit | c00a1ec093367b0a56b1085a119e776f503bed02 (patch) | |
tree | b044791423842447018f8d573e7a584142059fee | |
parent | b569e76c15af91d3cf953394428a50662287a16a (diff) |
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.
-rw-r--r-- | app/models/network/graph.rb | 9 | ||||
-rw-r--r-- | lib/banzai/filter/relative_link_filter.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/shell.rb | 5 |
4 files changed, 15 insertions, 6 deletions
diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index 6da3bb7bfb7..ecbeb24ee0a 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -40,9 +40,12 @@ module Network # Get commits from repository # def collect_commits - find_commits(count_to_display_commit_in_center).map do |commit| - # Decorate with app/model/network/commit.rb - Network::Commit.new(commit) + # 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| + # Decorate with app/model/network/commit.rb + Network::Commit.new(commit) + end end end diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index 93e6d6470f1..2745905c5ff 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -150,7 +150,10 @@ module Banzai end def uri_type(path) - @uri_types[path] ||= current_commit.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) + end end def current_commit diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 0ab53f8f706..5aeedb0f50d 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -28,7 +28,7 @@ module Gitlab PEM_REGEX = /\-+BEGIN CERTIFICATE\-+.+?\-+END CERTIFICATE\-+/m SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION' - MAXIMUM_GITALY_CALLS = 35 + MAXIMUM_GITALY_CALLS = 30 CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze MUTEX = Mutex.new diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 1153e69d3de..c7d8dfcd495 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -280,7 +280,10 @@ module Gitlab # add_namespace("default", "gitlab") # def add_namespace(storage, name) - Gitlab::GitalyClient::NamespaceService.new(storage).add(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) + end rescue GRPC::InvalidArgument => e raise ArgumentError, e.message end |