summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r--app/controllers/dashboard/projects_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb
index d5ccec28fdd..039991e07a2 100644
--- a/app/controllers/dashboard/projects_controller.rb
+++ b/app/controllers/dashboard/projects_controller.rb
@@ -66,7 +66,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
@total_user_projects_count = ProjectsFinder.new(params: { non_public: true }, current_user: current_user).execute
@total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute
- finder_params[:use_cte] = Feature.enabled?(:use_cte_for_projects_finder, default_enabled: true)
+ finder_params[:use_cte] = true if use_cte_for_finder?
projects = ProjectsFinder
.new(params: finder_params, current_user: current_user)
@@ -79,6 +79,11 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
end
# rubocop: enable CodeReuse/ActiveRecord
+ def use_cte_for_finder?
+ # The starred action loads public projects, which causes the CTE to be less efficient
+ action_name == 'index' && Feature.enabled?(:use_cte_for_projects_finder, default_enabled: true)
+ end
+
def load_events
projects = load_projects(params.merge(non_public: true))