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.raw_tag_match(name).where("true /* Tag#update_category_post_counts */").find_each do |post|
|
||||
post.reload
|
||||
# sometimes a post gets expunged
|
||||
if post
|
||||
post.set_tag_counts(false)
|
||||
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
|
||||
post.set_tag_counts(false)
|
||||
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
|
||||
|
||||
@@ -16,7 +16,7 @@ module Danbooru
|
||||
yield
|
||||
rescue ::ActiveRecord::StatementInvalid => x
|
||||
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
|
||||
return default_value
|
||||
ensure
|
||||
|
||||
Reference in New Issue
Block a user