debian-mirror-gitlab/lib/gitlab/health_checks/db_check.rb
2019-10-12 21:52:04 +05:30

27 lines
489 B
Ruby

# frozen_string_literal: true
module Gitlab
module HealthChecks
class DbCheck
extend SimpleAbstractCheck
class << self
private
def metric_prefix
'db_ping'
end
def successful?(result)
result == '1'
end
def check
catch_timeout 10.seconds do
ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.[]('ping')&.to_s
end
end
end
end
end
end