Skip to content

BugFix - Track File Upload Index #14822

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Apr 25, 2025

  • Tests written, or not not needed

Problem

Currently, the logic implemented in FileUploadWorker processes file uploads in discrete batches, which limits our ability to track the overall upload progress accurately and total upload index is wrong. We have outer while loop to update uploads and inner for loop for uploads.

For example, when a user attempts to upload 164 files:

  1. The first batch is processed, triggering a progress notification for files 1–2.
  2. The second batch then triggers a notification for files 23–2.
  3. The third batch triggers a notification for files 53–2
  4. ... and final batch 164-2.

How to reproduce?

  1. Create a folder
  2. Try to upload n times file
  3. Observe file upload notification

Solution

  1. Refactor the FileUploadWorker logic to support uploading all files without batches, thus we can track all progress.
  2. Pass totalUploadSize and use it in the worker, this will result in minimal changes.

I chose the second one

Demo

ddd.mp4

Signed-off-by: alperozturk <[email protected]>
if (totalUploadSize != null) {
startFilesUploadJob(user, totalUploadSize)
} else {
startFilesUploadJob(user)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some calls (e.g., FilesSyncWork) to startFilesUploadJob() don't have totalUploadSize, so we need two versions of it.

Copy link

Codacy

Lint

TypemasterPR
Warnings5451
Errors1111

SpotBugs

CategoryBaseNew
Bad practice6565
Correctness5859
Dodgy code292280
Experimental11
Internationalization77
Malicious code vulnerability11
Multithreaded correctness77
Performance5148
Security1818
Total500486

Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/14822.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 enabled auto-merge April 25, 2025 10:15
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.

1 participant