diff --git a/app/models/post.rb b/app/models/post.rb index f45770b3d..919cfbf58 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1207,10 +1207,6 @@ class Post < ApplicationRecord PostReadOnly.tag_match(tags).count end - if count.nil? - count = fast_count_search_batched(tags, options) - end - if count.nil? # give up if options[:raise_on_timeout] @@ -1227,26 +1223,6 @@ class Post < ApplicationRecord return nil end - def fast_count_search_batched(tags, options) - # this is slower but less likely to timeout - i = Post.maximum(:id) - sum = 0 - while i > 0 - count = PostReadOnly.with_timeout(1_000, nil, {:tags => tags}) do - sum += PostReadOnly.tag_match(tags).where("id <= ? and id > ?", i, i - 25_000).count - i -= 25_000 - end - - if count.nil? - return nil - end - end - sum - - rescue PG::ConnectionBad - return nil - end - def fix_post_counts(post) post.set_tag_counts(false) if post.changes_saved?