feat: add readiness healthzer

This commit is contained in:
Kevin Franklin Kim
2024-03-27 13:43:59 +01:00
parent 1617ebbd84
commit 71dfd39ff5
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
-include .makerc
.DEFAULT_GOAL:=help
-include .makerc
# --- Targets -----------------------------------------------------------------
+6 -4
View File
@@ -58,13 +58,15 @@ func NewHTTPCommand() *cobra.Command {
repo.WithPoll(pollFlag(v)),
)
// start initial update and handle error
svr.AddStartupHealthzers(healthz.NewHealthzerFn(func(ctx context.Context) error {
isLoadedHealtherFn := healthz.NewHealthzerFn(func(ctx context.Context) error {
if !r.Loaded() {
return errors.New("repo not ready yet")
return errors.New("repo not loaded yet")
}
return nil
}))
})
// start initial update and handle error
svr.AddStartupHealthzers(isLoadedHealtherFn)
svr.AddReadinessHealthzers(isLoadedHealtherFn)
svr.AddServices(
service.NewGoRoutine(l, "repo", func(ctx context.Context, l *zap.Logger) error {