From cb851a167b11b3de1ca22275fb0bd336fcba791b Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Thu, 19 Sep 2024 15:06:23 +0300 Subject: [PATCH] feat: modify retryablehttp retry setting values * RetryWaitMin: increase to 2 seconds (library default is 1 second) * RetryWaitMax: increase to 60 seconds (library default is 30 seconds) * RetryMax: increase to 7 (library default is 4) --- client.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index e6855fa..d810706 100644 --- a/client.go +++ b/client.go @@ -40,8 +40,36 @@ func NewClient(opts ...Option) (Client, error) { } c := retryablehttp.NewClient() - c.Logger = nil + + // Retry settings explanation: + // Default values (retryWaitMin = 1s, retryWaitMax = 30s, retryMax = 4) + // Changed values (retryWaitMin = 2s, retryWaitMax = 10s, retryMax = 6) + // + // Default values | Changed values + // Run Seconds | Run Seconds + // 0 0.000 | 0 0.000 + // 1 1.000 | 1 2.000 + // 2 3.000 | 2 6.000 + // 3 7.000 | 3 10.000 + // 4 15.000 | 4 10.000 (capped at retryWaitMax) + // | 5 10.000 (capped at retryWaitMax) + // | 6 10.000 (capped at retryWaitMax) + // + // Maximum wait time if all attempts fail: + // Default values: 2 seconds + // Changed values: 48 seconds + const ( + //nolint:revive + retryWaitMin = 2 * time.Second + retryWaitMax = 10 * time.Second + retryMax = 6 + ) + c.RetryWaitMin = retryWaitMin // Default is 1 second + c.RetryWaitMax = retryWaitMax // Default is 30 seconds + c.RetryMax = retryMax // Default is 4 retries (5 attempts in total) c.CheckRetry = checkRetry + + c.Logger = nil d.doer = c.StandardClient() // User settings