File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ type Config struct {
4242 UserAgent string
4343 // Retry controls automatic retry of throttled (HTTP 429) requests.
4444 // When nil (the default), throttled requests fail immediately.
45+ // See RetryConfig for REST vs. Upload API differences in MaxWaitSeconds.
4546 Retry * RetryConfig
4647}
4748
Original file line number Diff line number Diff line change @@ -171,6 +171,8 @@ func (c *restAPIClient) handleResponse(
171171 }
172172 wait := retryAfter
173173 if wait <= 0 {
174+ // Without a usable Retry-After from the server, REST retries fall
175+ // back to exponential backoff instead of applying MaxWaitSeconds.
174176 wait = expBackoff (tries )
175177 }
176178 select {
Original file line number Diff line number Diff line change @@ -6,9 +6,14 @@ type RetryConfig struct {
66 // MaxRetries is the maximum number of retry attempts.
77 // 0 means no retries even if RetryConfig is set.
88 MaxRetries int
9- // MaxWaitSeconds caps retry waits.
10- // For REST requests, a positive Retry-After above this cap fails fast.
11- // For upload requests, locally computed backoff is clamped to this cap.
9+ // MaxWaitSeconds limits retry waits, but the exact behavior depends on
10+ // which API returned HTTP 429:
11+ // - REST API: if the server sends a positive Retry-After above this
12+ // value, the request fails fast with ThrottleError instead of retrying.
13+ // Fallback exponential backoff used when Retry-After is absent or
14+ // invalid is not capped by this field.
15+ // - Upload API: locally computed exponential backoff is clamped to this
16+ // value because the upload API does not return Retry-After.
1217 // 0 means no cap.
1318 MaxWaitSeconds int
1419}
You can’t perform that action at this time.
0 commit comments