diff options
author | Nick Thomas <nick@gitlab.com> | 2018-04-11 00:55:02 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-04-11 00:55:02 +0100 |
commit | 3f73bdd837f9803b75eca484a0a0615db6c58c80 (patch) | |
tree | 0bd2c99d9198bfa22e7a29f375131f940033da7b /app/controllers/projects/branches_controller.rb | |
parent | b594ab949d1a2ceb9d949ff2641679fbdf273452 (diff) | |
parent | 37a5632483b67ddcfa4c535cc911319b25f01fb5 (diff) | |
download | gitlab-ce-xterm-npm.tar.gz |
Merge branch 'master' into xterm-npmxterm-npm
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-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 |