Class: VitalsMonitor::Checks::Postgres

Inherits:
Base
  • Object
show all
Defined in:
lib/vitals_monitor/checks/postgres.rb

Constant Summary

Constants inherited from Base

Base::TIMEOUT

Instance Method Summary collapse

Instance Method Details

#checkObject



6
7
8
9
10
11
12
13
14
# File 'lib/vitals_monitor/checks/postgres.rb', line 6

def check
  timeout do
    connection = ActiveRecord::Base.connection
    connection.execute("SELECT 1")
    healthy
  end
rescue StandardError => e
  unhealthy("PostgreSQL connection failed: #{e.message}")
end