Commit 63c0a702 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'allow-ref-name-caching-projects-controller' into 'master'

Enable FindCommit caching for project and commits pages

See merge request gitlab-org/gitlab-ce!27048
parents 4dd53240 f1dce216
...@@ -14,6 +14,8 @@ class Projects::CommitsController < Projects::ApplicationController ...@@ -14,6 +14,8 @@ class Projects::CommitsController < Projects::ApplicationController
before_action :validate_ref!, except: :commits_root before_action :validate_ref!, except: :commits_root
before_action :set_commits, except: :commits_root before_action :set_commits, except: :commits_root
around_action :allow_gitaly_ref_name_caching
def commits_root def commits_root
redirect_to project_commits_path(@project, @project.default_branch) redirect_to project_commits_path(@project, @project.default_branch)
end end
......
...@@ -26,6 +26,8 @@ class ProjectsController < Projects::ApplicationController ...@@ -26,6 +26,8 @@ class ProjectsController < Projects::ApplicationController
before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export] before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export]
before_action :event_filter, only: [:show, :activity] before_action :event_filter, only: [:show, :activity]
around_action :allow_gitaly_ref_name_caching, only: [:index, :show]
layout :determine_layout layout :determine_layout
def index def index
......
---
title: Enable FindCommit caching for project and commits pages
merge_request: 27048
author:
type: performance
...@@ -113,6 +113,8 @@ describe Projects::CommitsController do ...@@ -113,6 +113,8 @@ describe Projects::CommitsController do
render_views render_views
before do before do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original unless id.include?(' ')
get(:signatures, get(:signatures,
params: { params: {
namespace_id: project.namespace, namespace_id: project.namespace,
......
...@@ -78,6 +78,10 @@ describe ProjectsController do ...@@ -78,6 +78,10 @@ describe ProjectsController do
end end
context "user has access to project" do context "user has access to project" do
before do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
end
context "and does not have notification setting" do context "and does not have notification setting" do
it "initializes notification as disabled" do it "initializes notification as disabled" do
get :show, params: { namespace_id: public_project.namespace, id: public_project } get :show, params: { namespace_id: public_project.namespace, id: public_project }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment