zero/health-checks: fix early checks sometimes missing (#5229)

* zero/health-checks: fix early checks sometimes missing

* rm closure

* fix test
This commit is contained in:
Denis Mishin 2024-08-20 22:13:45 -04:00 committed by GitHub
parent 6591e3f539
commit 6e766233c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 109 additions and 80 deletions

View file

@ -73,12 +73,14 @@ func (srv *Telemetry) Run(ctx context.Context) error {
})
eg, ctx := errgroup.WithContext(ctx)
eg.Go(func() error { return srv.reporter.Run(ctx) })
eg.Go(func() error { return srv.handleRequests(ctx) })
eg.Go(func() error {
health.SetProvider(srv.reporter)
defer health.SetProvider(nil)
return srv.reporter.Run(ctx)
<-ctx.Done()
health.SetProvider(nil)
return nil
})
eg.Go(func() error { return srv.handleRequests(ctx) })
return eg.Wait()
}