diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-02 12:26:55 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-02 12:26:55 +0300 |
commit | b2ef5746952a6d29d9885002719b4f01c2c60f64 (patch) | |
tree | 8748ba05e26647a5ec40c57c8b7b77149b9b44a4 /lib/gitlab | |
parent | 0586ea1ca1c753d609c91e6c710a16ad20b72d2e (diff) | |
parent | 725d921d1fcf07cb967d0224a22965369dfaa846 (diff) |
Merge branch 'n-plus-1-notice' into 'master'
Adds a Gitaly n+1 notice to commit handling on access check
See merge request gitlab-org/gitlab-ee!3034
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/checks/change_access.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/gitlab/checks/change_access.rb b/lib/gitlab/checks/change_access.rb index a4c53a4f871..84d6035bf4d 100644 --- a/lib/gitlab/checks/change_access.rb +++ b/lib/gitlab/checks/change_access.rb @@ -162,14 +162,17 @@ module Gitlab # if newrev is blank, the branch was deleted return if deletion? || !(commit_validation || validate_path_locks?) - commits.each do |commit| - if commit_validation - error = check_commit(commit, push_rule) - raise GitAccess::UnauthorizedError, error if error - end - - if error = check_commit_diff(commit, push_rule) - raise GitAccess::UnauthorizedError, error + # n+1: https://gitlab.com/gitlab-org/gitlab-ee/issues/3593 + Gitlab::GitalyClient.allow_n_plus_1_calls do + commits.each do |commit| + if commit_validation + error = check_commit(commit, push_rule) + raise GitAccess::UnauthorizedError, error if error + end + + if error = check_commit_diff(commit, push_rule) + raise GitAccess::UnauthorizedError, error + end end end end |