Class: Gitlab::GitalyClient::HealthCheckService
- Inherits:
-
Object
- Object
- Gitlab::GitalyClient::HealthCheckService
- Defined in:
- lib/gitlab/gitaly_client/health_check_service.rb
Instance Method Summary collapse
-
#check ⇒ Object
Sends a gRPC health ping to the Gitaly server for the storage shard.
-
#initialize(storage) ⇒ HealthCheckService
constructor
A new instance of HealthCheckService.
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
#check ⇒ Object
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 |