diff --git a/app/models/tag.rb b/app/models/tag.rb index 5b3466645..07e0d7d40 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -35,8 +35,7 @@ class Tag < ActsAsTaggableOn::Tag before_save :mark_as_updated after_commit :bust_cache - after_update_commit :bust_articles_cache - + pg_search_scope :search_by_name, against: :name, using: { tsearch: { prefix: true } } @@ -102,13 +101,6 @@ class Tag < ActsAsTaggableOn::Tag Tags::BustCacheWorker.perform_async(name) end - def bust_articles_cache - article_ids = articles.published.order(created_at: :desc).limit(100).ids - article_ids.each_slice(10) do |ids| - Articles::BustMultipleCachesWorker.perform_async(ids) - end - end - def validate_alias_for return if Tag.exists?(name: alias_for) diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index b65726b50..b5ca689a7 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -122,17 +122,6 @@ RSpec.describe Tag, type: :model do end end - it "triggers articles cache busting on save" do - sidekiq_perform_enqueued_jobs do - tag.save - end - first = create(:article, tags: tag.name, published: true) - second = create(:article, tags: tag.name, published: true) - sidekiq_assert_enqueued_with(job: Articles::BustMultipleCachesWorker, args: [[second.id, first.id]]) do - tag.save - end - end - it "finds mod chat channel" do channel = create(:chat_channel) tag.mod_chat_channel_id = channel.id