Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry instead of failing on OneDrive 400 errors #646

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/duplicacy_oneclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,12 @@ func (client *OneDriveClient) call(url string, method string, input interface{},
continue
} else if response.StatusCode == 409 {
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 && !(
method == "PATCH" && response.StatusCode == 400) {
// MoveFile uses PATCH method, and it unfortunately relies on
// processing 400 errors for detecting non-existent target
// folders. So in this case we bubble up 400 errors to be handled
// in MoveFile
delay := int((rand.Float32() * 0.5 + 0.5) * 1000.0 * float32(backoff))
if backoffList, found := response.Header["Retry-After"]; found && len(backoffList) > 0 {
retryAfter, _ := strconv.Atoi(backoffList[0])
Expand Down