diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-12-11 11:43:34 +0300 |
---|---|---|
committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2019-02-27 22:19:50 +0300 |
commit | 022ee0c0c91d30dea3c1c0472525e86ec8379827 (patch) | |
tree | e50e74ec12ffcfe3e3964f53cbdce872af7f4527 /app | |
parent | cd063eec32a8b32d9b118f6cbdb0e96de0d0ec51 (diff) |
don't filter tags by taggable type
Due to performance reasons we cannot use the type filter on the tags.
The table for ActsAsTaggableOn is too big and too unoptimized, such that
the queries time out on production.
See the discussion
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19740#note_120087938
for more info.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 2 | ||||
-rw-r--r-- | app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb | 13 |
2 files changed, 2 insertions, 13 deletions
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index dd6b3c98496..8a00408001e 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -49,7 +49,7 @@ class Admin::RunnersController < Admin::ApplicationController end def tag_list - tags = Autocomplete::ActsAsTaggableOn::TagsFinder.new(taggable_type: Ci::Runner, params: params).execute + tags = Autocomplete::ActsAsTaggableOn::TagsFinder.new(params: params).execute render json: ActsAsTaggableOn::TagSerializer.new.represent(tags) end diff --git a/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb b/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb index 81e22c85d34..71dffb72dce 100644 --- a/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb +++ b/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb @@ -5,30 +5,19 @@ module Autocomplete class TagsFinder LIMIT = 20 - def initialize(taggable_type:, params:) - @taggable_type = taggable_type + def initialize(params:) @params = params end def execute @tags = ::ActsAsTaggableOn::Tag.all - filter_by_taggable_type! search! limit! @tags end - def filter_by_taggable_type! - # rubocop: disable CodeReuse/ActiveRecord - @tags = @tags - .joins(:taggings) - .where(taggings: { taggable_type: @taggable_type.name }) - .distinct - # rubocop: enable CodeReuse/ActiveRecord - end - def search! search = @params[:search] |