Commit ab0c3e08 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'sh-add-gitaly-ref-caching-search-controller' into 'master'

Enable Gitaly ref caching for SearchController

See merge request gitlab-org/gitlab-ce!30105
parents 80735a2d ee791d3f
......@@ -516,4 +516,10 @@ class ApplicationController < ActionController::Base
def sentry_context
Gitlab::Sentry.context(current_user)
end
def allow_gitaly_ref_name_caching
::Gitlab::GitalyClient.allow_ref_name_caching do
yield
end
end
end
......@@ -87,10 +87,4 @@ class Projects::ApplicationController < ApplicationController
def check_issues_available!
return render_404 unless @project.feature_available?(:issues, current_user)
end
def allow_gitaly_ref_name_caching
::Gitlab::GitalyClient.allow_ref_name_caching do
yield
end
end
end
......@@ -5,6 +5,8 @@ class SearchController < ApplicationController
include SearchHelper
include RendersCommits
around_action :allow_gitaly_ref_name_caching
skip_before_action :authenticate_user!
requires_cross_project_access if: -> do
search_term_present = params[:search].present? || params[:term].present?
......
---
title: Enable Gitaly ref caching for SearchController
merge_request: 30105
author:
type: performance
......@@ -17,6 +17,10 @@ describe SearchController do
set(:project) { create(:project, :public, :repository, :wiki_repo) }
before do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
end
subject { get(:show, params: { project_id: project.id, scope: scope, search: 'merge' }) }
where(:partial, :scope) do
......
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