Skip to content

Commit

Permalink
Log.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Aug 20, 2024
1 parent 213de4c commit f6d2465
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ func WithRetries(cfg RetryConfig, f func(attempt int, err error) error) error {
sleepIfNecessary(cfg, attempt, err)
err = f(attempt, err)
if err == nil {
if attempt > 0 {
// Only log if there was more than one attempt, so it's less noisy.
slog.Info("Retry was successful!", slog.Int("attempts", attempt))
}

return nil
} else if !cfg.IsRetryableErr(err) {
break
}
}

return err
}

Expand Down

0 comments on commit f6d2465

Please sign in to comment.