update to rails 4.2.5.1, add debugging info for tracking slow queries

This commit is contained in:
r888888888
2016-02-23 16:33:43 -08:00
parent bb3eb9f980
commit 4b24a5cb7e
13 changed files with 670 additions and 646 deletions

View File

@@ -183,7 +183,7 @@ class Artist < ActiveRecord::Base
if params[:name]
artist.name = params[:name]
post = CurrentUser.without_safe_mode do
Post.tag_match("source:http #{artist.name}").first
Post.tag_match("source:http #{artist.name}").where("true /* Artist.new_with_defaults */").first
end
unless post.nil? || post.source.blank?
artist.url_string = post.source
@@ -271,7 +271,7 @@ class Artist < ActiveRecord::Base
ti.destroy if ti
begin
Post.tag_match(name).each do |post|
Post.tag_match(name).where("true /* Artist.unban */").each do |post|
post.unban!
fixed_tags = post.tag_string.sub(/(?:\A| )banned_artist(?:\Z| )/, " ").strip
post.update_attributes(:tag_string => fixed_tags)
@@ -289,7 +289,7 @@ class Artist < ActiveRecord::Base
Post.transaction do
CurrentUser.without_safe_mode do
begin
Post.tag_match(name).each do |post|
Post.tag_match(name).where("true /* Artist.ban */").each do |post|
post.ban!
end
rescue Post::SearchError

View File

@@ -71,7 +71,7 @@ class Tag < ActiveRecord::Base
end
def real_post_count
@real_post_count ||= Post.raw_tag_match(name).count
@real_post_count ||= Post.raw_tag_match(name).where("true /* Tag#real_post_count */").count
end
def fix_post_count
@@ -131,7 +131,7 @@ class Tag < ActiveRecord::Base
def update_category_post_counts
Post.with_timeout(30_000, nil) do
Post.raw_tag_match(name).find_each do |post|
Post.raw_tag_match(name).where("true /* Tag#update_category_post_counts */").find_each do |post|
post.reload
post.set_tag_counts
Post.where(:id => post.id).update_all(:tag_count => post.tag_count, :tag_count_general => post.tag_count_general, :tag_count_artist => post.tag_count_artist, :tag_count_copyright => post.tag_count_copyright, :tag_count_character => post.tag_count_character)

View File

@@ -186,7 +186,7 @@ class TagImplication < ActiveRecord::Base
def update_posts
Post.without_timeout do
Post.raw_tag_match(antecedent_name).find_each do |post|
Post.raw_tag_match(antecedent_name).where("true /* TagImplication#update_posts */").find_each do |post|
fixed_tags = "#{post.tag_string} #{descendant_names}".strip
CurrentUser.scoped(creator, creator_ip_addr) do
post.update_attributes(