From eceb390152c5729a2e471a7d56b09986799806e1 Mon Sep 17 00:00:00 2001 From: buengese Date: Sat, 31 Aug 2024 02:37:56 +0200 Subject: [PATCH] zoho: try to handle rate limits a bit better --- backend/zoho/zoho.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/zoho/zoho.go b/backend/zoho/zoho.go index 34eb8b202..8f0811813 100644 --- a/backend/zoho/zoho.go +++ b/backend/zoho/zoho.go @@ -304,8 +304,9 @@ func shouldRetry(ctx context.Context, resp *http.Response, err error) (bool, err fs.Debugf(nil, "Should retry: %v", err) } if resp != nil && resp.StatusCode == 429 { - fs.Errorf(nil, "zoho: rate limit error received, sleeping for 60s: %v", err) - time.Sleep(180 * time.Second) + err = pacer.RetryAfterError(err, 60*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 }