Skip to content

Commit

Permalink
add checks
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Feb 29, 2024
1 parent 207196b commit 21ff722
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion api/v1/server/handlers/metadata/health.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package metadata

import (
"fmt"

"github.com/labstack/echo/v4"

"github.com/hatchet-dev/hatchet/api/v1/server/oas/gen"
Expand All @@ -11,6 +13,13 @@ func (u *MetadataService) LivenessGet(ctx echo.Context, request gen.LivenessGetR
}

func (u *MetadataService) ReadinessGet(ctx echo.Context, request gen.ReadinessGetRequestObject) (gen.ReadinessGetResponseObject, error) {
// TODO check if db and queue are ready
if !u.config.Repository.Health().IsHealthy() {
return nil, fmt.Errorf("repository is not healthy")
}

if !u.config.TaskQueue.IsReady() {
return nil, fmt.Errorf("repository is not healthy")
}

return gen.ReadinessGet200Response{}, nil
}

0 comments on commit 21ff722

Please sign in to comment.