providers: remove TreatAuthAsTransient, which changed only an error's text (#8299)
release / go (push) Successful in 1m48s
release / web (push) Successful in 1m19s
release / integration (push) Successful in 2m38s
release / govulncheck (push) Successful in 20s
release / android (push) Successful in 4m29s
release / Build signed APK (push) Successful in 4m57s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 1m48s
release / web (push) Successful in 1m19s
release / integration (push) Successful in 2m38s
release / govulncheck (push) Successful in 20s
release / android (push) Successful in 4m29s
release / Build signed APK (push) Successful in 4m57s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped
Without the option a 401 or 403 already fell to the default branch, which answers ErrTransient without a retry, the same as the option's own branch. The only difference was "(auth)" in the message. TheAudioDB and both Last.fm providers set it; none read the message. The reason it gave, that a bad key retries later instead of settling the row as "none", now sits on the default branch, and the client's status table checks 401 and 403. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,10 +45,6 @@ type HTTPOptions struct {
|
||||
MaxRetries int
|
||||
// BaseBackoff is the backoff unit: 2^attempt × base ± 20%.
|
||||
BaseBackoff time.Duration
|
||||
// TreatAuthAsTransient maps 401/403 to ErrTransient, so a bad or
|
||||
// expired key retries later rather than settling the row as "none".
|
||||
// Keyed providers want this.
|
||||
TreatAuthAsTransient bool
|
||||
// JSONBodyLimit and ImageBodyLimit cap a response body, against a
|
||||
// runaway upstream.
|
||||
JSONBodyLimit int64
|
||||
@@ -191,10 +187,6 @@ func (c *HTTPClient) attempt(ctx context.Context, fullURL, accept string, attemp
|
||||
case resp.StatusCode == http.StatusNotFound:
|
||||
_ = resp.Body.Close()
|
||||
return nil, false, ErrNotFound
|
||||
case c.opts.TreatAuthAsTransient &&
|
||||
(resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden):
|
||||
_ = resp.Body.Close()
|
||||
return nil, false, fmt.Errorf("%w: status %d (auth)", ErrTransient, resp.StatusCode)
|
||||
case resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode >= 500:
|
||||
_ = resp.Body.Close()
|
||||
if attempt < c.opts.MaxRetries {
|
||||
@@ -205,6 +197,9 @@ func (c *HTTPClient) attempt(ctx context.Context, fullURL, accept string, attemp
|
||||
}
|
||||
return nil, false, fmt.Errorf("%w: status %d", ErrTransient, resp.StatusCode)
|
||||
default:
|
||||
// Any other answer, a refused key's 401 or 403 included, is
|
||||
// transient: a bad or expired key is asked again later instead of
|
||||
// settling the row as having nothing to find.
|
||||
_ = resp.Body.Close()
|
||||
return nil, false, fmt.Errorf("%w: status %d", ErrTransient, resp.StatusCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user