You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
546 B
23 lines
546 B
package discovery |
|
|
|
import ( |
|
"context" |
|
|
|
"google.golang.org/grpc/health/grpc_health_v1" |
|
) |
|
|
|
// HealthServer 实现健康检查 |
|
type HealthServer struct { |
|
grpc_health_v1.UnimplementedHealthServer |
|
// healthy bool |
|
} |
|
|
|
func NewHealthServer() *HealthServer { |
|
return &HealthServer{} |
|
} |
|
|
|
func (s *HealthServer) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) { |
|
return &grpc_health_v1.HealthCheckResponse{ |
|
Status: grpc_health_v1.HealthCheckResponse_SERVING, // 或 NOT_SERVING |
|
}, nil |
|
}
|
|
|