Przeglądaj źródła

Reconnect when connection lost

Andrew Kane 8 lat temu
rodzic
commit
1605121478
1 zmienionych plików z 1 dodań i 0 usunięć
  1. 1 0
      lib/blazer/adapters/sql_adapter.rb

+ 1 - 0
lib/blazer/adapters/sql_adapter.rb

@@ -34,6 +34,7 @@ module Blazer
         rescue => e
           error = e.message.sub(/.+ERROR: /, "")
           error = Blazer::TIMEOUT_MESSAGE if Blazer::TIMEOUT_ERRORS.any? { |e| error.include?(e) }
+          reconnect if defined?(PG::ConnectionBad) && e.is_a?(PG::ConnectionBad)
         end
 
         [columns, rows, error]