Class: Gruf::Controllers::HealthController

Inherits:
Base
  • Object
show all
Defined in:
lib/gruf/controllers/health_controller.rb

Overview

Dynamic standard grpc health check controller. Can be used as-is, or can use ::Gruf.health_check_hook to provide custom responses.

Instance Attribute Summary

Attributes inherited from Base

#error, #request

Instance Method Summary collapse

Methods inherited from Base

bind, #call, #initialize, #process_action

Methods included from Errors::Helpers

#fail!

Constructor Details

This class inherits a constructor from Gruf::Controllers::Base

Instance Method Details

#checkObject



29
30
31
32
33
34
35
36
# File 'lib/gruf/controllers/health_controller.rb', line 29

def check
  health_proc = ::Gruf.health_check_hook
  return health_proc.call(request, error) if !health_proc.nil? && health_proc.respond_to?(:call)

  ::Grpc::Health::V1::HealthCheckResponse.new(
    status: ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::SERVING
  )
end