summaryrefslogtreecommitdiff
path: root/lib/gitlab/health_checks/redis/cache_check.rb
blob: a28658d42d439be3d7d40fef81a0f90b2e183906 (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
30
31
module Gitlab
  module HealthChecks
    module Redis
      class CacheCheck
        extend SimpleAbstractCheck

        class << self
          def check_up
            check
          end

          private

          def metric_prefix
            'redis_cache_ping'
          end

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

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