newrelic: log with_timeout errors as expected.
Make it so that when a database call inside a `with_timeout` block times out, the error logged to New Relic is marked as expected. This is so that expected timeouts, such as timeouts when calculating search counts or timeouts when generating related tags for the sidebar, don't count against the error rate.
This commit is contained in:
@@ -136,7 +136,7 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
connection.execute("SET STATEMENT_TIMEOUT = #{n}") unless Rails.env.test?
|
||||
yield
|
||||
rescue ::ActiveRecord::StatementInvalid => e
|
||||
DanbooruLogger.log(e, expected: false, **new_relic_params)
|
||||
DanbooruLogger.log(e, expected: true, **new_relic_params)
|
||||
default_value
|
||||
ensure
|
||||
connection.execute("SET STATEMENT_TIMEOUT = #{CurrentUser.user.try(:statement_timeout) || 3_000}") unless Rails.env.test?
|
||||
|
||||
Reference in New Issue
Block a user