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 return
} }
var lastErr error
ctx, canc := context.WithCancel(context.Background()) ctx, canc := context.WithCancel(context.Background())
defer canc() defer canc()
for range retries(ctx, 3, time.Second, 2) { for range retries(ctx, 4, 2*time.Second, 2) {
if err := scrape(); err != nil { if err := scrape(); err != nil {
log.Printf("Scrape error: %v", err) log.Printf("Scrape error: %v", err)
lastErr = err
continue continue
} }
return return
} }
log.Fatalf("Scrape failed, bailing entirely: %v", lastErr) log.Fatal("Multiple scrape attempts failed, aborting entirely")
} }
func main() { func main() {