From e081551dc04a462287b6b0bb251c662ecedacb07 Mon Sep 17 00:00:00 2001 From: rhymes Date: Mon, 26 Jul 2021 11:12:33 +0200 Subject: [PATCH] Revert "Clear recent articles cache on updating tags (#14298)" (#14330) This reverts commit 71591994029d1cb861b1c82906acd0ba92c4f112. --- app/models/tag.rb | 10 +--------- spec/models/tag_spec.rb | 11 ----------- 2 files changed, 1 insertion(+), 20 deletions(-) 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