diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2017-09-19 10:55:37 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-19 10:55:37 +0000 |
commit | 64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5 (patch) | |
tree | 2cc89bc2d1087eb145918c6ae8cbf70878d40e97 /app/services/notes/create_service.rb | |
parent | 39dd7736585d3e35d5c6f391e6a94c312da09056 (diff) | |
download | gitlab-ce-64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5.tar.gz |
Detect n+1 issues involving Gitaly
Diffstat (limited to 'app/services/notes/create_service.rb')
-rw-r--r-- | app/services/notes/create_service.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index 06971483992..9ea28733f5f 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -4,7 +4,13 @@ module Notes merge_request_diff_head_sha = params.delete(:merge_request_diff_head_sha) note = Notes::BuildService.new(project, current_user, params).execute - return note unless note.valid? + + # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37440 + note_valid = Gitlab::GitalyClient.allow_n_plus_1_calls do + note.valid? + end + + return note unless note_valid # We execute commands (extracted from `params[:note]`) on the noteable # **before** we save the note because if the note consists of commands |