mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-21 08:04:07 +09:00
chore(grpc): add health check and grpc v1, alpha version
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
@ -13,8 +13,6 @@ import (
|
||||
"gitea.com/gitea/proto-go/runner/v1/runnerv1connect"
|
||||
|
||||
"github.com/bufbuild/connect-go"
|
||||
grpchealth "github.com/bufbuild/connect-grpchealth-go"
|
||||
grpcreflect "github.com/bufbuild/connect-grpcreflect-go"
|
||||
)
|
||||
|
||||
type RunnerService struct{}
|
||||
@ -55,26 +53,5 @@ func runnerServiceRoute(r *web.Route) {
|
||||
compress1KB,
|
||||
)
|
||||
|
||||
// grpcV1
|
||||
grpcPath, gHandler := grpcreflect.NewHandlerV1(
|
||||
grpcreflect.NewStaticReflector(runnerv1connect.RunnerServiceName),
|
||||
compress1KB,
|
||||
)
|
||||
|
||||
// grpcV1Alpha
|
||||
grpcAlphaPath, gAlphaHandler := grpcreflect.NewHandlerV1Alpha(
|
||||
grpcreflect.NewStaticReflector(runnerv1connect.RunnerServiceName),
|
||||
compress1KB,
|
||||
)
|
||||
|
||||
// grpcHealthCheck
|
||||
grpcHealthPath, gHealthHandler := grpchealth.NewHandler(
|
||||
grpchealth.NewStaticChecker(runnerv1connect.RunnerServiceName),
|
||||
compress1KB,
|
||||
)
|
||||
|
||||
r.Post(connectPath+"{name}", grpcHandler(connecthandler))
|
||||
r.Post(grpcPath+"{name}", grpcHandler(gHandler))
|
||||
r.Post(grpcAlphaPath+"{name}", grpcHandler(gAlphaHandler))
|
||||
r.Post(grpcHealthPath+"{name}", grpcHandler(gHealthHandler))
|
||||
}
|
||||
|
Reference in New Issue
Block a user