Skip to content

Commit

Permalink
Add some erroring message and increase timeout to catch edge cases (#32)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
stylianosrigas and Stylianos Rigas authored Mar 14, 2024
1 parent 0f3be4c commit 0285d23
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/elrond/elrond_soak.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0285d23

Please sign in to comment.