From 0285d230ef1bc0e36cf79dca5e4a86f68c9e2c17 Mon Sep 17 00:00:00 2001 From: Stylianos Rigas Date: Thu, 14 Mar 2024 16:42:07 +0200 Subject: [PATCH] Add some erroring message and increase timeout to catch edge cases (#32) * Add some erroring message and increase timeout to catch edge cases * Add some erroring message and increase timeout to catch edge cases --------- Co-authored-by: Stylianos Rigas --- internal/elrond/elrond_soak.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/elrond/elrond_soak.go b/internal/elrond/elrond_soak.go index 7b26bfe..a84e038 100644 --- a/internal/elrond/elrond_soak.go +++ b/internal/elrond/elrond_soak.go @@ -51,9 +51,16 @@ func querySLOMetrics(ring *model.Ring, url string, queryTime time.Time, logger * var lastErr error // Retry mechanism for Thanos network connectivity issues. for attempt := 0; attempt < 10; attempt++ { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) logger.Infof("Running Thanos query %s, attempt %d", query, attempt+1) result, warnings, err := v1api.Query(ctx, query, queryTime) + if err != nil { + if errors.Is(err, context.DeadlineExceeded) { + logger.Errorf("Query failed due to timeout: %v", err) + } else { + logger.Errorf("Query failed due to an error: %v", err) + } + } cancel() if err == nil {