class MiddlewareHealthcheck::DefaultCheckers::ActiveRecordChecker
Constants
- EXCEPTION_REGEXP
- NOT_CONNECTED_ERROR
Attributes
error[RW]
Public Class Methods
new(_app, _env)
click to toggle source
# File lib/middleware_healthcheck/default_checkers/active_record_checker.rb, line 11 def initialize(_app, _env); end
Public Instance Methods
healthy?()
click to toggle source
# File lib/middleware_healthcheck/default_checkers/active_record_checker.rb, line 13 def healthy? ActiveRecord::Base.establish_connection ActiveRecord::Base.connection if ActiveRecord::Base.connected? true else self.error = NOT_CONNECTED_ERROR false end rescue StandardError => e if e.class.to_s.match? EXCEPTION_REGEXP # rubocop:disable Style/GuardClause self.error = e.message false else raise e end end