Welcome to mirror list, hosted at ThFree Co, Russian Federation.

db_check.rb « health_checks « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3df312af1bc51bd59e26fa1556d9d92243d15c06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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 == Gitlab::Database.database_base_models.size
        end

        def check
          catch_timeout 10.seconds do
            Gitlab::Database.database_base_models.sum do |_, base|
              base.connection.select_value('SELECT 1')
            end
          end
        end
      end
    end
  end
end