diff --git a/app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadHelper.kt b/app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadHelper.kt index 4ae93aa52c..878d3fa924 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadHelper.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadHelper.kt @@ -124,10 +124,6 @@ class FileUploadHelper { var uploadUser = Optional.empty() for (failedUpload in failedUploads) { - // 1. extract failed upload owner account and cache it between loops (expensive query) - if (!uploadUser.isPresent || !uploadUser.get().nameEquals(failedUpload.accountName)) { - uploadUser = accountManager.getUser(failedUpload.accountName) - } val isDeleted = !File(failedUpload.localPath).exists() if (isDeleted) { showNotExistMessage = true @@ -141,10 +137,16 @@ class FileUploadHelper { canUploadBeRetried(failedUpload, gotWifi, charging) && !connectivityService.isInternetWalled ) { // 2B. for existing local files, try restarting it if possible - retryUpload(failedUpload, uploadUser.get()) + failedUpload.uploadStatus = UploadStatus.UPLOAD_IN_PROGRESS + uploadsStorageManager.updateUpload(failedUpload) } } + accountManager.accounts.forEach { + val user = accountManager.getUser(it.name) + if (user.isPresent) backgroundJobManager.startFilesUploadJob(user.get()) + } + return showNotExistMessage }