Class: Gitlab::GitalyClient::HealthCheckService

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/gitaly_client/health_check_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(storage) ⇒ HealthCheckService

Returns a new instance of HealthCheckService.



6
7
8
# File 'lib/gitlab/gitaly_client/health_check_service.rb', line 6

def initialize(storage)
  @storage = storage
end

Instance Method Details

#checkObject

Sends a gRPC health ping to the Gitaly server for the storage shard.



11
12
13
14
15
16
17
18
# File 'lib/gitlab/gitaly_client/health_check_service.rb', line 11

def check
  request = Grpc::Health::V1::HealthCheckRequest.new
  response = GitalyClient.call(@storage, :health_check, :check, request, timeout: GitalyClient.fast_timeout)

  { success: response&.status == :SERVING }
rescue GRPC::BadStatus => e
  { success: false, message: e.to_s }
end