diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-20 17:53:16 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-20 17:53:16 +0000 |
commit | a6fe183eb00f8060668e66b80a4afd64f1c5f73f (patch) | |
tree | 3fdde150b8f8811b14246a7b82d31586a8ac507a | |
parent | 347e2b40758e567ae9b1c3855674c8e9027040f4 (diff) | |
parent | 2a520b1ce75f2f06d9780f9b6f17893d9f775422 (diff) | |
download | gitlab-ce-a6fe183eb00f8060668e66b80a4afd64f1c5f73f.tar.gz |
Merge branch 'avoid_es_loading_project_ci_status' into 'master'
Avoid loading pipeline status in project search
See merge request gitlab-org/gitlab-ce!26342
-rw-r--r-- | app/helpers/projects_helper.rb | 5 | ||||
-rw-r--r-- | app/views/search/_results.html.haml | 2 | ||||
-rw-r--r-- | app/views/shared/projects/_project.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/avoid_es_loading_project_ci_status.yml | 5 |
4 files changed, 10 insertions, 4 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5496aa4908c..f2abb241753 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -169,7 +169,7 @@ module ProjectsHelper translation.html_safe end - def project_list_cache_key(project) + def project_list_cache_key(project, pipeline_status: true) key = [ project.route.cache_key, project.cache_key, @@ -179,10 +179,11 @@ module ProjectsHelper Gitlab::CurrentSettings.cache_key, "cross-project:#{can?(current_user, :read_cross_project)}", max_project_member_access_cache_key(project), + pipeline_status, 'v2.6' ] - key << pipeline_status_cache_key(project.pipeline_status) if project.pipeline_status.has_status? + key << pipeline_status_cache_key(project.pipeline_status) if pipeline_status && project.pipeline_status.has_status? key end diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index be7a2436d16..2e62039b90a 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -20,7 +20,7 @@ .search-results - if @scope == 'projects' .term - = render 'shared/projects/list', projects: @search_objects + = render 'shared/projects/list', projects: @search_objects, pipeline_status: false - else = render partial: "search/results/#{@scope.singularize}", collection: @search_objects diff --git a/app/views/shared/projects/_project.html.haml b/app/views/shared/projects/_project.html.haml index d2b1be29eb9..90fb067e75d 100644 --- a/app/views/shared/projects/_project.html.haml +++ b/app/views/shared/projects/_project.html.haml @@ -10,7 +10,7 @@ - show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true && can_show_last_commit_in_list?(project) - css_class = '' unless local_assigns[:css_class] - css_class += " no-description" if project.description.blank? && !show_last_commit_as_description -- cache_key = project_list_cache_key(project) +- cache_key = project_list_cache_key(project, pipeline_status: pipeline_status) - updated_tooltip = time_ago_with_tooltip(project.last_activity_date) - css_controls_class = compact_mode ? "" : "flex-lg-row justify-content-lg-between" - avatar_container_class = project.creator && use_creator_avatar ? '' : 'rect-avatar' diff --git a/changelogs/unreleased/avoid_es_loading_project_ci_status.yml b/changelogs/unreleased/avoid_es_loading_project_ci_status.yml new file mode 100644 index 00000000000..514909c730d --- /dev/null +++ b/changelogs/unreleased/avoid_es_loading_project_ci_status.yml @@ -0,0 +1,5 @@ +--- +title: Avoid loading pipeline status in project search +merge_request: 26342 +author: +type: performance |