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

[Discussion]: Possible improvements to the upload queue management #5589

Open
ShashwatKedia opened this issue Mar 2, 2024 · 2 comments
Open
Labels
gsoc Google Summer of Code

Comments

@ShashwatKedia
Copy link
Contributor

As discussed here, this issue aims to discuss the potential enhancements which can be made to the current upload queue management. If you have any questions about how the app should behave regarding the upload queue, please feel free to ask them here. By doing so, the maintainers won't have to answer the same questions repeatedly.

@kanahia1
Copy link
Contributor

kanahia1 commented Mar 2, 2024

Great Idea ✨ to create a discussion channel

@ShashwatKedia
Copy link
Contributor Author

ShashwatKedia commented Mar 2, 2024

After a lot of debugging and uploading a decent amount of pictures on Commons, this is the flow I observed (posting here for everyone's benefit) :

(Just so everyone understands the reference, STATE_QUEUED means, the item will have a ‘Queued’ tag and STATE_IN_PROGRESS means, the item will have a non-started progress bar animation)

  1. When the upload starts for the first time, all pictures are by default given the STATE_QUEUED in UploadPresenter.
  2. In UploadWorker’s doWork(), all items which are in STATE_QUEUED & STATE_QUEUED_LIMITED_CONNECTION_MODE are converted to STATE_IN_PROGRESS.
  3. In UploadWorker’s doWork(), for the current item getting uploaded, the state is again set to STATE_IN_PROGRESS and continues that till it gets uploaded successfully and gets the STATE_COMPLETED or pauses and gets the STATE_PAUSED or fails and gets the STATE_FAILED.
  4. If the current item upload succeeds, then the same process (step 3) is repeated for the next item.
  5. If the user closes the app, and comes back to ContributionsFragment, then all other items in STATE_IN_PROGRESS are converted to STATE_QUEUED by checkAndResumeStuckUploads() in MainActivity.
  6. If any item’s upload fails, it goes to STATE_FAILED and stays as it is, till either the user hits the retry button or the user closes the app and reopens it (since retryUploads() is called in onResume() of MainActivity) and they are given the STATE_QUEUED in restartUploads(), and step 2 follows. The STATE_FAILED items are not automatically re-tried, even if there is no other item left to be uploaded until the user closes the app or opens another activity and reopens MainActivity.

There are some issues with the pause and resume buttons as well, but since they are not a part of the given task, it would be better to discuss them here.

(i) I suggest to set the state to STATE_IN_PROGRESS only when the item is currently being uploaded, that is to skip step 2 and go to step 3 directly. By, doing this, only the current item being uploaded will have a progress bar and the rest will have a Queued or Failed or Paused tag.
(ii) I recommend to start the upload of the Failed items, when no other item is left to be uploaded, even when the user doesn’t close and reopen the app.
(iii) I also suggest to set the tag of STATE_QUEUED items with a 'Queued (N)' tag, where 'N' represents the position of the image in the uploads queue, which will update as and when another image is paused or fails or gets uploaded successfully.

This will create a standard upload flow, wherein only the item currently getting uploaded will have a progress bar and other items will have a 'Queued (N)' tag or 'Paused' or 'Failed' tag.

Below, I have attached a rough flowchart of what an ideal flow should be, according to me :

Final Flow SS

Suggestions and feedback regarding the above flow are more than welcome :)

@nicolas-raoul nicolas-raoul added the gsoc Google Summer of Code label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc Google Summer of Code
Projects
None yet
Development

No branches or pull requests

3 participants