diff options
author | Rémy Coutable <remy@rymai.me> | 2018-04-03 15:03:31 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-03 15:03:31 +0000 |
commit | e3e461fbe1642fdbe787152369a573ef48ceffd9 (patch) | |
tree | 0b77611f0babff7eb9fbb480794e4185adcfee80 /app | |
parent | 83b2e70341a3721f7897aaf0b806a1535f50115c (diff) | |
parent | 78ea82c3e2073d7e81c59f7fbc09587892ba6729 (diff) | |
download | gitlab-ce-e3e461fbe1642fdbe787152369a573ef48ceffd9.tar.gz |
Merge branch '44861-mark-gitaly-nplus-one-again' into 'master'
Re-enable allowing n+1 Gitaly for branches index
Closes #44861
See merge request gitlab-org/gitlab-ce!18131
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 176679f0849..b7b36f770f5 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -22,9 +22,13 @@ class Projects::BranchesController < Projects::ApplicationController @refs_pipelines = @project.pipelines.latest_successful_for_refs(@branches.map(&:name)) @merged_branch_names = repository.merged_branch_names(@branches.map(&:name)) - @max_commits = @branches.reduce(0) do |memo, branch| - diverging_commit_counts = repository.diverging_commit_counts(branch) - [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max + + # n+1: https://gitlab.com/gitlab-org/gitaly/issues/992 + Gitlab::GitalyClient.allow_n_plus_1_calls do + @max_commits = @branches.reduce(0) do |memo, branch| + diverging_commit_counts = repository.diverging_commit_counts(branch) + [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max + end end render |