summaryrefslogtreecommitdiff
path: root/lib/api/branches.rb
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2017-09-19 10:55:37 +0000
committerRémy Coutable <remy@rymai.me>2017-09-19 10:55:37 +0000
commit64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5 (patch)
tree2cc89bc2d1087eb145918c6ae8cbf70878d40e97 /lib/api/branches.rb
parent39dd7736585d3e35d5c6f391e6a94c312da09056 (diff)
downloadgitlab-ce-64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5.tar.gz
Detect n+1 issues involving Gitaly
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r--lib/api/branches.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 642c1140fcc..643c8e6fb8e 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -21,7 +21,10 @@ module API
get ':id/repository/branches' do
branches = ::Kaminari.paginate_array(user_project.repository.branches.sort_by(&:name))
- present paginate(branches), with: Entities::RepoBranch, project: user_project
+ # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37442
+ Gitlab::GitalyClient.allow_n_plus_1_calls do
+ present paginate(branches), with: Entities::RepoBranch, project: user_project
+ end
end
resource ':id/repository/branches/:branch', requirements: BRANCH_ENDPOINT_REQUIREMENTS do