diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2017-09-19 13:55:37 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-19 13:55:37 +0300 |
commit | 64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5 (patch) | |
tree | 2cc89bc2d1087eb145918c6ae8cbf70878d40e97 /app/controllers/projects/network_controller.rb | |
parent | 39dd7736585d3e35d5c6f391e6a94c312da09056 (diff) |
Detect n+1 issues involving Gitaly
Diffstat (limited to 'app/controllers/projects/network_controller.rb')
-rw-r--r-- | app/controllers/projects/network_controller.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb index dfa5e4f7f46..fb68dd771a1 100644 --- a/app/controllers/projects/network_controller.rb +++ b/app/controllers/projects/network_controller.rb @@ -8,19 +8,24 @@ class Projects::NetworkController < Projects::ApplicationController before_action :assign_commit def show - @url = project_network_path(@project, @ref, @options.merge(format: :json)) - @commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s") + # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37602 + Gitlab::GitalyClient.allow_n_plus_1_calls do + @url = project_network_path(@project, @ref, @options.merge(format: :json)) + @commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s") - respond_to do |format| - format.html do - if @options[:extended_sha1] && !@commit - flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist." + respond_to do |format| + format.html do + if @options[:extended_sha1] && !@commit + flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist." + end end - end - format.json do - @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) + format.json do + @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) + end end + + render end end |