Skip to content
Snippets Groups Projects
Unverified Commit b4c0b2f9 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Fix health check destroying db connections (#5249)

parent a73a3140
Branches
Tags
No related merge requests found
......@@ -37,10 +37,7 @@ class HealthChecksController < ApplicationController
private
def check_database
ActiveRecord::Base.establish_connection # Establishes connection
ActiveRecord::Base.connection # Calls connection object
raise 'Unable to connect to Database' unless ActiveRecord::Base.connected?
raise 'Unable to connect to Database' unless ActiveRecord::Base.connection.active?
raise 'Unable to connect to Database - pending migrations' unless ActiveRecord::Migration.check_pending!.nil?
rescue StandardError => e
raise "Unable to connect to Database - #{e}"
......
......@@ -32,9 +32,7 @@ namespace :configuration do
info 'Checking connection to Postgres Database:'
begin
ActiveRecord::Base.establish_connection # Establishes connection
ActiveRecord::Base.connection # Calls connection object
failed('Unable to connect to Database') unless ActiveRecord::Base.connected?
failed('Unable to connect to Database') unless ActiveRecord::Base.connection.active?
rescue StandardError => e
failed("Unable to connect to Database - #{e}")
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment