Commit f1dce216 authored by Stan Hu's avatar Stan Hu

Enable FindCommit caching for project and commits pages

This reduces a handful of duplicate FindCommit calls while viewing the
projects and commits pages.
parent 3962b00b
......@@ -14,6 +14,8 @@ class Projects::CommitsController < Projects::ApplicationController
before_action :validate_ref!, except: :commits_root
before_action :set_commits, except: :commits_root
around_action :allow_gitaly_ref_name_caching
def commits_root
redirect_to project_commits_path(@project, @project.default_branch)
end
......
......@@ -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 :event_filter, only: [:show, :activity]
around_action :allow_gitaly_ref_name_caching, only: [:index, :show]
layout :determine_layout
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
render_views
before do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original unless id.include?(' ')
get(:signatures,
params: {
namespace_id: project.namespace,
......
......@@ -78,6 +78,10 @@ describe ProjectsController do
end
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
it "initializes notification as disabled" do
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