Business intelligence made simple
Changed timeouts to consecutive errors
Andrew Kane46eee75f07f3
diff --git a/app/models/blazer/check.rb b/app/models/blazer/check.rbindex 07c0f40c..3f05f203 100644--- a/app/models/blazer/check.rb+++ b/app/models/blazer/check.rb@@ -25,12 +25,12 @@ module Blazerself.last_run_at = Time.now if respond_to?(:last_run_at=)- if respond_to?(:timeouts=)- if state == "timed out"- self.timeouts += 1- self.state = "disabled" if timeouts >= 3+ if respond_to?(:consecutive_errors=)+ if state == "timed out" || state == "error"+ self.consecutive_errors += 1+ self.state = "disabled" if consecutive_errors >= 3else- self.timeouts = 0+ self.consecutive_errors = 0endenddiff --git a/lib/generators/blazer/templates/install.rb b/lib/generators/blazer/templates/install.rbindex 235b6244..a11d605f 100644--- a/lib/generators/blazer/templates/install.rb+++ b/lib/generators/blazer/templates/install.rb@@ -38,7 +38,7 @@ class <%= migration_class_name %> < ActiveRecord::Migrationt.text :emailst.boolean :invertt.timestamp :last_run_at- t.integer :timeouts, default: 0+ t.integer :consecutive_errors, default: 0t.timestampsendend