summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2018-03-06 13:32:48 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-03-06 13:32:48 +0000
commitb5ec6097b75819626083726d1073978d11aba7e3 (patch)
tree4e0dec2466b4fec72274710fdd8f824d84e7acee /app/controllers
parentaf84ccbd8227ac6d4d609bc8ff941ee6cad131f5 (diff)
downloadgitlab-ce-b5ec6097b75819626083726d1073978d11aba7e3.tar.gz
Fix Gitaly n+1 in NetworkController#show
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/network_controller.rb25
1 files changed, 11 insertions, 14 deletions
diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb
index 3b10a93e97f..35fec229db7 100644
--- a/app/controllers/projects/network_controller.rb
+++ b/app/controllers/projects/network_controller.rb
@@ -9,25 +9,22 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :assign_commit
def show
- # 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."
- end
- end
+ @url = project_network_path(@project, @ref, @options.merge(format: :json))
+ @commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")
- format.json do
- @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref])
+ 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
- render
+ format.json do
+ @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref])
+ end
end
+
+ render
end
def assign_commit