NewRetryTransport creates a custom HTTP transport that handles 429, 408, and 503 errors with exponential backoff. It wraps the provided transport and adds retry logic specifically for rate limiting, timeout, and service unavailable scenarios.
(base http.RoundTripper)
| 76 | // with exponential backoff. It wraps the provided transport and adds retry |
| 77 | // logic specifically for rate limiting, timeout, and service unavailable scenarios. |
| 78 | func NewRetryTransport(base http.RoundTripper) http.RoundTripper { |
| 79 | if base == nil { |
| 80 | base = http.DefaultTransport |
| 81 | } |
| 82 | return &retryTransport{ |
| 83 | base: base, |
| 84 | retry: DefaultRetry, |
| 85 | backoff: DefaultBackoff, |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // NewRetryTransportWithConfig creates a retry transport with custom retry and backoff settings |
| 90 | func NewRetryTransportWithConfig(base http.RoundTripper, retry Retry, backoff Backoff) http.RoundTripper { |
no outgoing calls