Sha256: 70071e8a20d02d86037e005d9e0a72dc0e2dc804eda6659a6ffe3d73fe0d7415
Contents?: true
Size: 771 Bytes
Versions: 2
Compression:
Stored size: 771 Bytes
Contents
# frozen_string_literal: true module MiddlewareHealthcheck module DefaultCheckers class ActiveRecordChecker NOT_CONNECTED_ERROR = "Can't connect to database." EXCEPTION_REGEXP = /^ActiveRecord::/.freeze attr_accessor :error def initialize(_app, _env); end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems