fix newrelic handler for statement timeouts
This commit is contained in:
@@ -141,12 +141,9 @@ class Tag < ApplicationRecord
|
|||||||
Post.with_timeout(30_000, nil, {:tags => name}) do
|
Post.with_timeout(30_000, nil, {:tags => name}) do
|
||||||
Post.raw_tag_match(name).where("true /* Tag#update_category_post_counts */").find_each do |post|
|
Post.raw_tag_match(name).where("true /* Tag#update_category_post_counts */").find_each do |post|
|
||||||
post.reload
|
post.reload
|
||||||
# sometimes a post gets expunged
|
post.set_tag_counts(false)
|
||||||
if post
|
args = TagCategory.categories.map {|x| ["tag_count_#{x}",post.send("tag_count_#{x}")]}.to_h.update(:tag_count => post.tag_count)
|
||||||
post.set_tag_counts(false)
|
Post.where(:id => post.id).update_all(args)
|
||||||
args = TagCategory.categories.map {|x| ["tag_count_#{x}",post.send("tag_count_#{x}")]}.to_h.update(:tag_count => post.tag_count)
|
|
||||||
Post.where(:id => post.id).update_all(args)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module Danbooru
|
|||||||
yield
|
yield
|
||||||
rescue ::ActiveRecord::StatementInvalid => x
|
rescue ::ActiveRecord::StatementInvalid => x
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
NewRelic::Agent.notice_error(x, :custom_params => new_relic_params.merge(:user_id => CurrentUser.user.id, :user_ip_addr => CurrentUser.ip_addr))
|
NewRelic::Agent.notice_error(x, :custom_params => new_relic_params.merge(:user_id => CurrentUser.id, :user_ip_addr => CurrentUser.ip_addr))
|
||||||
end
|
end
|
||||||
return default_value
|
return default_value
|
||||||
ensure
|
ensure
|
||||||
|
|||||||
Reference in New Issue
Block a user