summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-06-27 00:00:01 -0700
committerStan Hu <stanhu@gmail.com>2019-06-27 01:20:32 -0700
commit5729a91c0540e1269ee50c5f46726d79509e1bb4 (patch)
tree2e8990519c90acdc548e8218ca1fd9b6b00f85b7
parentedcd28ca44649b5b3e0729a95a4d6b684e1ff7cb (diff)
downloadgitlab-ce-sh-avoid-loading-pipeline-status.tar.gz
Avoid loading pipeline status in search resultssh-avoid-loading-pipeline-status
This improves the performance of search, since the pipeline status is not displayed. Identified in https://gitlab.com/gitlab-org/gitlab-ce/issues/56627
-rw-r--r--app/views/shared/projects/_list.html.haml2
-rw-r--r--changelogs/unreleased/sh-avoid-loading-pipeline-status.yml5
-rw-r--r--spec/controllers/search_controller_spec.rb13
3 files changed, 19 insertions, 1 deletions
diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml
index 13847cd9be1..576ec3e1782 100644
--- a/app/views/shared/projects/_list.html.haml
+++ b/app/views/shared/projects/_list.html.haml
@@ -28,7 +28,7 @@
.js-projects-list-holder
- if any_projects?(projects)
- - load_pipeline_status(projects)
+ - load_pipeline_status(projects) if pipeline_status
%ul.projects-list{ class: css_classes }
- projects.each_with_index do |project, i|
- css_class = (i >= projects_limit) || project.pending_delete? ? 'hide' : nil
diff --git a/changelogs/unreleased/sh-avoid-loading-pipeline-status.yml b/changelogs/unreleased/sh-avoid-loading-pipeline-status.yml
new file mode 100644
index 00000000000..2dead948786
--- /dev/null
+++ b/changelogs/unreleased/sh-avoid-loading-pipeline-status.yml
@@ -0,0 +1,5 @@
+---
+title: Avoid loading pipeline status in search results
+merge_request: 30111
+author:
+type: performance
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 4634d1d4bb3..4500597a212 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -35,6 +35,19 @@ describe SearchController do
end
end
+ context 'global search' do
+ render_views
+
+ it 'omits pipeline status from load' do
+ project = create(:project, :public)
+ expect(Gitlab::Cache::Ci::ProjectPipelineStatus).not_to receive(:load_in_batch_for_projects)
+
+ get :show, params: { scope: 'projects', search: project.name }
+
+ expect(assigns[:search_objects].first).to eq project
+ end
+ end
+
it 'finds issue comments' do
project = create(:project, :public)
note = create(:note_on_issue, project: project)