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
path: root/lib/api
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-26 10:34:47 +0300
committerStan Hu <stanhu@gmail.com>2018-12-27 15:24:37 +0300
commite7bd824484636fd4d4d7beb524b6bea3ecef533a (patch)
tree4b435626be5630c408e5ef4323420fe74a82118a /lib/api
parent77909a88460bbc864a5f95f3fa66053eb6cab5a8 (diff)
Fix timeout issues retrieving branches via API
47d4890d changed the order of pagination so that the full list of branches would be passed to Gitaly to determine which ones had been merged, but this operation can timeout for large repositories with many branches. We only need to determine whether the found branches have been merged, so limit the scan to those. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55724
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/branches.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index e7e58ad0e66..07f529b01bb 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -34,11 +34,11 @@ module API
repository = user_project.repository
branches = BranchesFinder.new(repository, declared_params(include_missing: false)).execute
-
+ branches = ::Kaminari.paginate_array(branches)
merged_branch_names = repository.merged_branch_names(branches.map(&:name))
present(
- paginate(::Kaminari.paginate_array(branches)),
+ paginate(branches),
with: Entities::Branch,
current_user: current_user,
project: user_project,