in internal/mode/webserver/webserver.go [455:479]
func watchdogOnce(ctx context.Context, client *http.Client, addr string) error {
defer metricWatchdogTotal.Inc()
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(30*time.Second))
defer cancel()
req, err := http.NewRequest("GET", addr, nil)
if err != nil {
return err
}
req = req.WithContext(ctx)
resp, err := client.Do(req)
if err != nil {
return err
}
body, _ := io.ReadAll(resp.Body)
_ = resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("watchdog: status=%v body=%q", resp.StatusCode, string(body))
}
return nil
}