class Superbolt::Runner::Pg

Public Instance Methods

on_error(message, error) click to toggle source
Calls superclass method
# File lib/superbolt/runner/pg.rb, line 4
def on_error(message, error)
  if reconnect_after_error?(error)
    ActiveRecord::Base.connection.reconnect!
  end

  super
end

Private Instance Methods

reconnect_after_error?(error) click to toggle source
# File lib/superbolt/runner/pg.rb, line 14
def reconnect_after_error?(error)
  error.is_a?(ActiveRecord::StatementInvalid) and
    error.message.start_with?("PG::UnableToSend") or
    error.message.start_with?("PG::ConnectionBad")
end