Skip to content

Commit

Permalink
feat: modify retryablehttp retry setting values
Browse files Browse the repository at this point in the history
* RetryWaitMin: increase to 2 seconds (library default is 1 second)
* RetryWaitMax: decrease to 10 seconds (library default is 30 seconds)
* RetryMax: increase to 6 (library default is 4)
  • Loading branch information
rriski committed Sep 19, 2024
1 parent 6c4af16 commit dad1fab
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dad1fab

Please sign in to comment.