debian-mirror-gitlab/lib/gitlab/health_checks/db_check.rb

30 lines
571 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module Gitlab
module HealthChecks
class DbCheck
extend SimpleAbstractCheck
class << self
private
def metric_prefix
'db_ping'
end
2018-03-17 18:26:18 +05:30
def successful?(result)
2022-05-07 20:08:51 +05:30
result == Gitlab::Database.database_base_models.size
2017-08-17 22:00:37 +05:30
end
def check
catch_timeout 10.seconds do
2022-05-07 20:08:51 +05:30
Gitlab::Database.database_base_models.sum do |_, base|
base.connection.select_value('SELECT 1')
end
2017-08-17 22:00:37 +05:30
end
end
end
end
end
end