update to rails 4.2.5.1, add debugging info for tracking slow queries
This commit is contained in:
@@ -12,7 +12,7 @@ module Moderator
|
||||
|
||||
CurrentUser.without_safe_mode do
|
||||
CurrentUser.scoped(updater, updater_ip_addr) do
|
||||
::Post.tag_match(antecedent).find_each do |post|
|
||||
::Post.tag_match(antecedent).where("true /* Moderator::TagBatchChange#perform */").find_each do |post|
|
||||
tags = (post.tag_array - normalized_antecedent + normalized_consequent).join(" ")
|
||||
post.update_attributes(:tag_string => tags)
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ module PostSets
|
||||
|
||||
def posts
|
||||
@posts ||= begin
|
||||
query = ::Post.tag_match(@artist.name).limit(10)
|
||||
query = ::Post.tag_match(@artist.name).where("true /* PostSets::Artist#posts */").limit(10)
|
||||
query.each # hack to force rails to eager load
|
||||
query
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ module PostSets
|
||||
end
|
||||
|
||||
def has_deleted?
|
||||
tag_string !~ /status/ && ::Post.tag_match("#{tag_string} status:deleted").exists?
|
||||
tag_string !~ /status/ && ::Post.tag_match("#{tag_string} status:deleted").where("true /* PostSets::Post#has_deleted */").exists?
|
||||
end
|
||||
|
||||
def has_explicit?
|
||||
@@ -127,9 +127,9 @@ module PostSets
|
||||
if random
|
||||
temp = get_random_posts()
|
||||
elsif raw
|
||||
temp = ::Post.raw_tag_match(tag_string).order("posts.id DESC").paginate(page, :count => post_count, :limit => per_page)
|
||||
temp = ::Post.raw_tag_match(tag_string).order("posts.id DESC").where("true /* PostSets::Post#posts:1 */").paginate(page, :count => post_count, :limit => per_page)
|
||||
else
|
||||
temp = ::Post.tag_match(tag_string, read_only).paginate(page, :count => post_count, :limit => per_page)
|
||||
temp = ::Post.tag_match(tag_string, read_only).where("true /* PostSets::Post#posts:2 */").paginate(page, :count => post_count, :limit => per_page)
|
||||
end
|
||||
temp.each # hack to force rails to eager load
|
||||
temp
|
||||
|
||||
@@ -53,9 +53,9 @@ class RelatedTagCalculator
|
||||
candidates = convert_hash_to_array(counts, 100)
|
||||
similar_counts = Hash.new {|h, k| h[k] = 0}
|
||||
CurrentUser.without_safe_mode do
|
||||
Post.with_timeout(5_000) do
|
||||
PostReadOnly.with_timeout(5_000) do
|
||||
candidates.each do |ctag, _|
|
||||
acount = Post.tag_match("#{tag} #{ctag}").count
|
||||
acount = PostReadOnly.tag_match("#{tag} #{ctag}").count
|
||||
ctag_record = Tag.find_by_name(ctag)
|
||||
div = Math.sqrt(tag_record.post_count * ctag_record.post_count)
|
||||
if div != 0
|
||||
|
||||
@@ -6,7 +6,7 @@ class UserDeletion
|
||||
def self.remove_favorites_for(user_id)
|
||||
user = User.find(user_id)
|
||||
Post.without_timeout do
|
||||
Post.raw_tag_match("fav:#{user_id}").find_each do |post|
|
||||
Post.raw_tag_match("fav:#{user_id}").where("true /* UserDeletion.remove_favorites_for */").find_each do |post|
|
||||
Favorite.remove(post, user)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user