zoho: try to handle rate limits a bit better

This commit is contained in:
buengese 2024-08-31 02:37:56 +02:00 committed by Nick Craig-Wood
parent f4deffdc96
commit eceb390152

View File

@ -304,8 +304,9 @@ func shouldRetry(ctx context.Context, resp *http.Response, err error) (bool, err
fs.Debugf(nil, "Should retry: %v", err) fs.Debugf(nil, "Should retry: %v", err)
} }
if resp != nil && resp.StatusCode == 429 { if resp != nil && resp.StatusCode == 429 {
fs.Errorf(nil, "zoho: rate limit error received, sleeping for 60s: %v", err) err = pacer.RetryAfterError(err, 60*time.Second)
time.Sleep(180 * time.Second) fs.Debugf(nil, "Too many requests. Trying again in %d seconds.", 60)
return true, err
} }
return authRetry || fserrors.ShouldRetry(err) || fserrors.ShouldRetryHTTP(resp, retryErrorCodes), err return authRetry || fserrors.ShouldRetry(err) || fserrors.ShouldRetryHTTP(resp, retryErrorCodes), err
} }