Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakuya Noguchi <takninnovationresearch@gmail.com>2018-03-26 18:57:13 +0300
committerTakuya Noguchi <takninnovationresearch@gmail.com>2018-03-28 17:06:17 +0300
commit05b4b2d9679ccd09cf9723207603d0d3f670df30 (patch)
tree6f7e7629cb4069f2ba977f7826e03c7c57fd4239 /app/controllers/projects/branches_controller.rb
parenta1cde68d208437a470267e28ccff66fe8be88c2e (diff)
Reuse root_ref_hash for performance on Branches
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r--app/controllers/projects/branches_controller.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 965cece600e..176679f0849 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -21,17 +21,13 @@ class Projects::BranchesController < Projects::ApplicationController
fetch_branches_by_mode
@refs_pipelines = @project.pipelines.latest_successful_for_refs(@branches.map(&:name))
- @merged_branch_names =
- repository.merged_branch_names(@branches.map(&:name))
- # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37429
- 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
-
- render
+ @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
end
+
+ render
end
format.json do
branches = BranchesFinder.new(@repository, params).execute