From c242c00799a54dd8fd37334b23c10dc00301a000 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 3 Oct 2024 10:29:07 +0100 Subject: [PATCH] onedrive: fix Retry-After handling to look at 503 errors also According to the Microsoft docs a Retry-After header can be returned on 429 errors and 503 errors, but before this change we were only checking for it on 429 errors. See: https://forum.rclone.org/t/onedrive-503-response-retry-after-not-used/48045 --- backend/onedrive/onedrive.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index 7db269c2f..b0db1ec98 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -827,7 +827,7 @@ func shouldRetry(ctx context.Context, resp *http.Response, err error) (bool, err retry = true fs.Debugf(nil, "HTTP 401: Unable to initialize RPS. Trying again.") } - case 429: // Too Many Requests. + case 429, 503: // Too Many Requests, Server Too Busy // see https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online if values := resp.Header["Retry-After"]; len(values) == 1 && values[0] != "" { retryAfter, parseErr := strconv.Atoi(values[0])