Class: Eventboss::ErrorHandlers::DbConnectionDropHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/eventboss/error_handlers/db_connection_drop_handler.rb

Instance Method Summary collapse

Instance Method Details

#call(exception, _context = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/eventboss/error_handlers/db_connection_drop_handler.rb', line 6

def call(exception, _context = {})
  return unless exception.is_a?(::ActiveRecord::StatementInvalid)

  if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('8.0.0')
    ::ActiveRecord::Base.clear_active_connections!
  else
    ::ActiveRecord::Base.connection_handler.clear_active_connections!
  end
end