@@ -79,7 +79,7 @@ module Blazer
@rows, @error, @cached_at = @data_source.run_statement(@statement, user: blazer_user, query: @query, refresh_cache: params[:check])
- if @query && !@error.to_s.include?("canceling statement due to statement timeout")
+ if @query && @error != Blazer::TIMEOUT_MESSAGE
@query.checks.each do |check|
check.update_state(@rows, @error)
end
@@ -20,6 +20,8 @@ module Blazer
self.audit = true
self.user_name = :name
+ TIMEOUT_MESSAGE = "Query timed out :("
+
def self.time_zone=(time_zone)
@time_zone = time_zone.is_a?(ActiveSupport::TimeZone) ? time_zone : ActiveSupport::TimeZone[time_zone.to_s]
@@ -82,6 +82,7 @@ module Blazer
rescue ActiveRecord::StatementInvalid => e
error = e.message.sub(/.+ERROR: /, "")
+ error = Blazer::TIMEOUT_MESSAGE if error.include?("canceling statement due to statement timeout") || error.include?("cancelled on user's request")