Business intelligence made simple
Friendlier timeout message
Andrew Kaneb9528b3c12d2
diff --git a/app/controllers/blazer/queries_controller.rb b/app/controllers/blazer/queries_controller.rbindex acf20be7..6c2fcd91 100644--- a/app/controllers/blazer/queries_controller.rb+++ b/app/controllers/blazer/queries_controller.rb@@ -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 && [email protected]_s.include?("canceling statement due to statement timeout")+ if @query && @error != Blazer::TIMEOUT_MESSAGE@query.checks.each do |check|check.update_state(@rows, @error)enddiff --git a/lib/blazer.rb b/lib/blazer.rbindex ffff1236..82debd9c 100644--- a/lib/blazer.rb+++ b/lib/blazer.rb@@ -20,6 +20,8 @@ module Blazerself.audit = trueself.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]enddiff --git a/lib/blazer/data_source.rb b/lib/blazer/data_source.rbindex bd541f95..c8cc264e 100644--- a/lib/blazer/data_source.rb+++ b/lib/blazer/data_source.rb@@ -82,6 +82,7 @@ module Blazerendrescue ActiveRecord::StatementInvalid => eerror = e.message.sub(/.+ERROR: /, "")+ error = Blazer::TIMEOUT_MESSAGE if error.include?("canceling statement due to statement timeout") || error.include?("cancelled on user's request")endend