summaryrefslogtreecommitdiff
path: root/lib/gitlab/health_checks/redis/shared_state_check.rb
blob: e3244392902a67af46977972ae69a2e9141e5797 (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 SharedStateCheck
        extend SimpleAbstractCheck

        class << self
          def check_up
            check
          end

          private

          def metric_prefix
            'redis_shared_state_ping'
          end

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

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