Tweak retry parameters

This commit is contained in:
Josh Deprez 2023-01-22 19:57:20 +11:00
parent 9d42148c64
commit 097776962c
Signed by: josh
SSH key fingerprint: SHA256:zZji7w1Ilh2RuUpbQcqkLPrqmRwpiCSycbF2EfKm6Kw

View file

@ -245,18 +245,16 @@ func metricsHandler(w http.ResponseWriter, r *http.Request) {
return
}
var lastErr error
ctx, canc := context.WithCancel(context.Background())
defer canc()
for range retries(ctx, 3, time.Second, 2) {
for range retries(ctx, 4, 2*time.Second, 2) {
if err := scrape(); err != nil {
log.Printf("Scrape error: %v", err)
lastErr = err
continue
}
return
}
log.Fatalf("Scrape failed, bailing entirely: %v", lastErr)
log.Fatal("Multiple scrape attempts failed, aborting entirely")
}
func main() {