android
android copied to clipboard
Remove unnecessary checks and calls from restartFailedUploads
The main idea of this PR was to fix double-checking upload conditions first in FileSyncHelper and then in FilesUploadHelper.
I noticed that currently these checks are in my opinion useless. The checks should only schedule those uploads that make sense to do at that moment (e.g. if upload is Wi-Fi only and user is not connected to Wi-Fi upload should not be scheduled and display an info message). Those delayed uploads have the state "failed" and last result e.g. "Delayed_for_wifi". This makes sense to me. The problem is that currently the worker not only tries to upload the scheduled Files but also the delayed files every time.
This makes no sense to me. I guess there are 2 options:
- Remove all the checks before scheduling, schedule all failed uploads, and let the FileUploadWorker decide which to start and which to skip. -> Basically the same behavior as we have currently, but more consistent and less unnecessary double-checks.
- Make the Worker only try to upload scheduled uploads. This changes the current behavior, since it would only try to upload delayed Uploads when "retryFailedUploads" is called. Currently, they are retried every time the upload worker runs (so e.g. also when uploading a new file etc.). Would be more performant and also more consistent than currently.
@tobiasKaminsky @ZetaTom @alperozturk96 What do you think is the best approach here? Do you think this changed behavior would be ok?
- [X] Tests written, or not not needed
2. Make the Worker only try to upload scheduled uploads. This changes the current behavior, since it would only try to upload delayed Uploads when "retryFailedUploads" is called. Currently, they are retried every time the upload worker runs (so e.g. also when uploading a new file etc.). Would be more performant and also more consistent than currently.
I am for this one. As this is then a bigger change, once it is in master/daily we should check that those failed ones are uploaded at some time (monitor on our own devices)
Codacy
Lint
| Type | master | PR |
| Warnings | 63 | 63 |
| Errors | 3 | 3 |
SpotBugs
| Category | Base | New |
|---|---|---|
| Bad practice | 64 | 64 |
| Correctness | 65 | 65 |
| Dodgy code | 314 | 314 |
| Experimental | 1 | 1 |
| Internationalization | 7 | 7 |
| Multithreaded correctness | 6 | 6 |
| Performance | 53 | 53 |
| Security | 18 | 18 |
| Total | 528 | 528 |
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13160.apk
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
Hello there, Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.
Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6
Thank you for contributing to Nextcloud and we hope to hear from you soon!
(If you believe you should not receive this message, you can add yourself to the blocklist.)