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

Try to only process changed files for auto upload #12719

Merged
merged 7 commits into from
Mar 25, 2024

Conversation

JonasMayerDev
Copy link
Collaborator

Initiated by #12596 the idea was to reduce the times the full file system scan for changed files for auto upload is needed. This PR adds that when ever ContentObserverWorker detects media files (so only images and videos) change, the FilesSyncWorker does not go through every file in the corresponding folders. Now it only checks which sync folder (if any) the file belongs to and only enqueues this file for upload.

Test this PR

To test this functionality, one can set up the camera folder as an auto upload folder and take pictures. The upload of the file should start after about at most 15s automatically in the background.

This behavior is the same as before, but it now should take less time for especially large media folders, and it does not use a foreground worker for the sync worker.

Known Issues

Sometimes some changes are not detected when too many changes happen one after another and the upload of those files stops until the app is opened. So sometime files are missing from upload. Though this is not optimal, it seems like this is an issue with the content observer worker. As we not really rely on this functionality (a full file system scan is still scheduled every 15 min) I think this is still better than the functionality before. So this functionality should rather be seen as a bonus that uploads files faster if it works but if not there is still a fallback.

  • Tests written, or not not needed

@JonasMayerDev JonasMayerDev force-pushed the autoupload_only_check_changes branch from 6414d69 to 24f97c2 Compare March 21, 2024 17:08
@JonasMayerDev JonasMayerDev force-pushed the autoupload_only_check_changes branch from 24f97c2 to 3529d0a Compare March 21, 2024 18:27
@alperozturk96 alperozturk96 force-pushed the autoupload_only_check_changes branch from 3529d0a to ef8e5f2 Compare March 22, 2024 13:28
Copy link
Collaborator

@alperozturk96 alperozturk96 left a comment

Choose a reason for hiding this comment

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

Tested on Android 14 and Android 7.1.1 working.

@alperozturk96 alperozturk96 enabled auto-merge March 22, 2024 16:07
@alperozturk96 alperozturk96 disabled auto-merge March 22, 2024 16:07
@tobiasKaminsky
Copy link
Member

/backport to stable-3.28

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: 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>
@JonasMayerDev JonasMayerDev force-pushed the autoupload_only_check_changes branch from 54e5958 to 22913b8 Compare March 25, 2024 09:54
Copy link

Codacy

Lint

TypemasterPR
Warnings7171
Errors33

SpotBugs

CategoryBaseNew
Bad practice6868
Correctness6868
Dodgy code350350
Experimental22
Internationalization77
Malicious code vulnerability22
Multithreaded correctness66
Performance5656
Security1919
Total578578

Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12719.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.

Copy link

@tobiasKaminsky tobiasKaminsky merged commit c681095 into master Mar 25, 2024
19 of 20 checks passed
@delete-merged-branch delete-merged-branch bot deleted the autoupload_only_check_changes branch March 25, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants