Optimize Article query in EdgeCache::BustArticle (#14916)

This commit is contained in:
Jamie Gaskins 2021-10-05 11:58:34 -04:00 committed by GitHub
parent a2712ffeb0
commit 268ea66dcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,7 +85,7 @@ module EdgeCache
end
TIMEFRAMES.each do |timestamp, interval|
next unless Article.published.where("published_at > ?", timestamp.call).tagged_with(tag)
next unless Article.published.where("published_at > ?", timestamp.call).cached_tagged_with_any(tag)
.order(public_reactions_count: :desc).limit(3).ids.include?(article.id)
cache_bust.call("/top/#{interval}")