mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
Merge pull request #12911 from nextcloud/improve-retry-failed-uploads-function
Improve retry failed uploads function
This commit is contained in:
commit
becdbd6fbe
1 changed files with 7 additions and 5 deletions
|
@ -124,10 +124,6 @@ class FileUploadHelper {
|
|||
var uploadUser = Optional.empty<User>()
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue