Business intelligence made simple
Attempt to reconnect for checks
Andrew Kanefa859601580f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cd04ac70..93d99964 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,3 +1,7 @@+## 1.3.2 [unreleased]++- Attempt to reconnect for checks+## 1.3.1- Fixed migration errordiff --git a/lib/blazer.rb b/lib/blazer.rbindex 14ab9822..25fd8636 100644--- a/lib/blazer.rb+++ b/lib/blazer.rb@@ -74,6 +74,9 @@ module BlazerRails.logger.info "[blazer timeout] query=#{check.query.name}"tries += 1sleep(10)+ elsif error.start_with?("PG::ConnectionBad")+ data_sources[check.query.data_source].reconnect+ tries += 1elsebreakenddiff --git a/lib/blazer/data_source.rb b/lib/blazer/data_source.rbindex e620628b..39e6f186 100644--- a/lib/blazer/data_source.rb+++ b/lib/blazer/data_source.rb@@ -139,6 +139,10 @@ module Blazer["MySQL", "Mysql2", "Mysql2Spatial"].include?(adapter_name)end+ def reconnect+ connection_model.establish_connection(settings["url"])+ end+protecteddef adapter_name