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

Remove unnecessary checks and calls from restartFailedUploads #13160

Merged
merged 5 commits into from
Jul 4, 2024

Conversation

JonasMayerDev
Copy link
Collaborator

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:

  1. 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.
  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.

@tobiasKaminsky @ZetaTom @alperozturk96 What do you think is the best approach here? Do you think this changed behavior would be ok?

  • Tests written, or not not needed

@tobiasKaminsky
Copy link
Member

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)

@JonasMayerDev JonasMayerDev force-pushed the make-upload-restart-more-efficient branch from 379976f to 09ba4fe Compare June 25, 2024 16:30
@JonasMayerDev JonasMayerDev marked this pull request as ready for review June 25, 2024 17:24
@tobiasKaminsky tobiasKaminsky linked an issue Jul 3, 2024 that may be closed by this pull request
5 tasks
JonasMayerDev and others added 5 commits July 3, 2024 12:20
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
@ZetaTom ZetaTom force-pushed the make-upload-restart-more-efficient branch from 09ba4fe to 3657923 Compare July 3, 2024 10:20
Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine on my machine. Adjusted some variable names and formatting.

Copy link

github-actions bot commented Jul 3, 2024

Codacy

Lint

TypemasterPR
Warnings6363
Errors33

SpotBugs

CategoryBaseNew
Bad practice6464
Correctness6565
Dodgy code314314
Experimental11
Internationalization77
Multithreaded correctness66
Performance5353
Security1818
Total528528

Copy link

github-actions bot commented Jul 3, 2024

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13160.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@alperozturk96 alperozturk96 merged commit 6bed2ff into master Jul 4, 2024
21 checks passed
@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.30.0 milestone Jul 4, 2024
@JonasMayerDev JonasMayerDev deleted the make-upload-restart-more-efficient branch July 30, 2024 10:55
Copy link

github-actions bot commented Aug 6, 2024

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove foreground worker for auto upload
5 participants