Skip to content

Commit a71d518

Browse files
dont retry on 404 & 409
1 parent 0ba70e9 commit a71d518

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

DriveBackup/src/main/java/ratismal/drivebackup/uploaders/onedrive/OneDriveUploader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,15 @@ private void uploadToSession(@NotNull String uploadURL, @NotNull RandomAccessFil
499499
retryCount = 0;
500500
} else if (uploadResponse.code() == 201 || uploadResponse.code() == 200) {
501501
break;
502-
} else { // TODO 404 409 416
503-
if (retryCount > MAX_RETRY_ATTEMPTS) {
502+
} else { // TODO 416
503+
if (retryCount > MAX_RETRY_ATTEMPTS || uploadResponse.code() == 409) {
504504
Request cancelRequest = new Request.Builder().url(uploadURL).delete().build();
505505
DriveBackup.httpClient.newCall(cancelRequest).execute().close();
506506
throw new GraphApiErrorException(uploadResponse);
507507
}
508+
if (uploadResponse.code() == 404) {
509+
throw new GraphApiErrorException(uploadResponse);
510+
}
508511
if (uploadResponse.code() >= 500 && uploadResponse.code() < 600) {
509512
TimeUnit.MILLISECONDS.sleep(exponentialBackoffMillis);
510513
exponentialBackoffMillis *= EXPONENTIAL_BACKOFF_FACTOR;

0 commit comments

Comments
 (0)