Enable Gitaly FindCommit caching for TreeController
Accessing /namespace/project/tree/master appears to query FindCommit 5 times with identical parameters. This reduces the number of FindCommit queries to 1.
This commit is contained in:
parent
b416555411
commit
021e8790c6
3 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,8 @@ class Projects::TreeController < Projects::ApplicationController
|
||||||
include CreatesCommit
|
include CreatesCommit
|
||||||
include ActionView::Helpers::SanitizeHelper
|
include ActionView::Helpers::SanitizeHelper
|
||||||
|
|
||||||
|
around_action :allow_gitaly_ref_name_caching, only: [:show]
|
||||||
|
|
||||||
before_action :require_non_empty_project, except: [:new, :create]
|
before_action :require_non_empty_project, except: [:new, :create]
|
||||||
before_action :assign_ref_vars
|
before_action :assign_ref_vars
|
||||||
before_action :assign_dir_vars, only: [:create_dir]
|
before_action :assign_dir_vars, only: [:create_dir]
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Enable Gitaly FindCommit caching for TreeController
|
||||||
|
merge_request: 27100
|
||||||
|
author:
|
||||||
|
type: performance
|
|
@ -16,6 +16,8 @@ describe Projects::TreeController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
|
||||||
|
|
||||||
get(:show,
|
get(:show,
|
||||||
params: {
|
params: {
|
||||||
namespace_id: project.namespace.to_param,
|
namespace_id: project.namespace.to_param,
|
||||||
|
|
Loading…
Reference in a new issue