mirror of
https://github.com/foomo/contentserver.git
synced 2026-08-16 22:20:19 +00:00
feat: add readiness healthzer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-include .makerc
|
||||
.DEFAULT_GOAL:=help
|
||||
-include .makerc
|
||||
|
||||
# --- Targets -----------------------------------------------------------------
|
||||
|
||||
|
||||
+6
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user