diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-02-12 18:31:02 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-02-12 19:22:26 +0300 |
commit | 50749135aa689c09dece150fb903bd3176de72e2 (patch) | |
tree | 2b39fd3b2b5e7ead82550a67f9176bd255eee746 /app/services/delete_merged_branches_service.rb | |
parent | 80c1626b2776b300acaaee85d11012b96893d004 (diff) |
Remove allow_n_plus_1 block from DeleteMergedBranchesService
Fixes #37438
Fixes gitaly#999
Diffstat (limited to 'app/services/delete_merged_branches_service.rb')
-rw-r--r-- | app/services/delete_merged_branches_service.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/services/delete_merged_branches_service.rb b/app/services/delete_merged_branches_service.rb index cb235a85daf..c98d1e3c540 100644 --- a/app/services/delete_merged_branches_service.rb +++ b/app/services/delete_merged_branches_service.rb @@ -6,18 +6,14 @@ class DeleteMergedBranchesService < BaseService def execute raise Gitlab::Access::AccessDeniedError unless can?(current_user, :push_code, project) - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37438 - Gitlab::GitalyClient.allow_n_plus_1_calls do - branches = project.repository.branch_names - branches = branches.select { |branch| project.repository.merged_to_root_ref?(branch) } - # Prevent deletion of branches relevant to open merge requests - branches -= merge_request_branch_names - # Prevent deletion of protected branches - branches = branches.reject { |branch| ProtectedBranch.protected?(project, branch) } + branches = project.repository.merged_branch_names + # Prevent deletion of branches relevant to open merge requests + branches -= merge_request_branch_names + # Prevent deletion of protected branches + branches = branches.reject { |branch| ProtectedBranch.protected?(project, branch) } - branches.each do |branch| - DeleteBranchService.new(project, current_user).execute(branch) - end + branches.each do |branch| + DeleteBranchService.new(project, current_user).execute(branch) end end |