summaryrefslogtreecommitdiff
path: root/lib/gitlab/health_checks/redis_check.rb
blob: 57bbe5b3ad03fe2fd517931c0a4981b0953db4c0 (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
module Gitlab
  module HealthChecks
    class RedisCheck
      extend SimpleAbstractCheck

      class << self
        private

        def metric_prefix
          'redis_ping'
        end

        def is_successful?(result)
          result == 'PONG'
        end

        def check
          catch_timeout 10.seconds do
            Gitlab::Redis.with(&:ping)
          end
        end
      end
    end
  end
end