1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-12 06:13:23 +00:00

OneDrive sometimes generates spurious 400 errors, these are perfectly fine to retry on instead of failing the whole run.

This commit is contained in:
Victor Mozgin
2023-03-06 11:02:42 -05:00
parent 24c2ea76b9
commit ee344a0abe

View File

@@ -201,7 +201,7 @@ func (client *OneDriveClient) call(url string, method string, input interface{},
continue continue
} else if response.StatusCode == 409 { } else if response.StatusCode == 409 {
return nil, 0, OneDriveError{Status: response.StatusCode, Message: "Conflict"} return nil, 0, OneDriveError{Status: response.StatusCode, Message: "Conflict"}
} else if response.StatusCode > 401 && response.StatusCode != 404 { } else if response.StatusCode >= 400 && response.StatusCode != 404 {
delay := int((rand.Float32() * 0.5 + 0.5) * 1000.0 * float32(backoff)) delay := int((rand.Float32() * 0.5 + 0.5) * 1000.0 * float32(backoff))
if backoffList, found := response.Header["Retry-After"]; found && len(backoffList) > 0 { if backoffList, found := response.Header["Retry-After"]; found && len(backoffList) > 0 {
retryAfter, _ := strconv.Atoi(backoffList[0]) retryAfter, _ := strconv.Atoi(backoffList[0])