in v2/health.go [62:80]
func (h *HealthChecker) periodicHealthCheck(ctx context.Context, hc HealthCheckable, namespaceName string, client *azservicebus.Client) {
nextCheck := time.Now()
for {
select {
case <-ctx.Done():
return
case <-time.After(time.Until(nextCheck)):
func() {
sbCtx, cancel := context.WithTimeout(ctx, h.options.HealthCheckTimeout)
defer cancel()
err := hc.HealthCheck(sbCtx, namespaceName, client)
if err != nil {
getLogger(ctx).Error(fmt.Sprintf("Health check failed for namespace %s: %s", namespaceName, err.Error()))
}
}()
nextCheck = nextCheck.Add(h.options.HealthCheckInterval)
}
}
}