Skip to content
Snippets Groups Projects
Commit ee791d3f authored by Stan Hu's avatar Stan Hu
Browse files

Enable Gitaly ref caching for SearchController

As we noticed in
https://gitlab.com/gitlab-org/gitlab-ce/issues/56627#note_185828742,
clicking on the "Issues" tab often requests the same reference in
rendering Markdown.
parent 13d89920
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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?
Loading
Loading
---
title: Enable Gitaly ref caching for SearchController
merge_request: 30105
author:
type: performance
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment