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

[FEATURE REQUEST] Automatic removal of downloaded files and local storage clean up #4320

Conversation

Aitorbp
Copy link
Contributor

@Aitorbp Aitorbp commented Feb 19, 2024

@Aitorbp Aitorbp self-assigned this Feb 19, 2024
@Aitorbp Aitorbp linked an issue Feb 19, 2024 that may be closed by this pull request
14 tasks
@jesmrec jesmrec added Dependencies Pull requests that update a dependency file Estimation - 1 (XS) Sprint and removed Estimation - 1 (XS) Sprint Dependencies Pull requests that update a dependency file labels Feb 20, 2024
@Aitorbp Aitorbp requested a review from JuancaG05 February 20, 2024 15:00
@Aitorbp
Copy link
Contributor Author

Aitorbp commented Feb 20, 2024

For temporal files will also be deleted according to their last modification date with respect to the selected time.

@Aitorbp Aitorbp force-pushed the feature/automatic_removal_downloaded_files_local_storage_clean_up branch 5 times, most recently from 5b818dd to 2edfd85 Compare February 21, 2024 21:47
@Aitorbp
Copy link
Contributor Author

Aitorbp commented Feb 22, 2024

I update you how is the new setting view:
delete_local_copies
advance_screen

Copy link
Collaborator

@JuancaG05 JuancaG05 left a comment

Choose a reason for hiding this comment

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

Some changes requested here @Aitorbp

@Aitorbp Aitorbp force-pushed the feature/automatic_removal_downloaded_files_local_storage_clean_up branch from 2d4e65b to b05c8f5 Compare February 27, 2024 16:12
@Aitorbp Aitorbp requested a review from JuancaG05 February 27, 2024 16:27
@Aitorbp Aitorbp force-pushed the feature/automatic_removal_downloaded_files_local_storage_clean_up branch from 6829116 to bf6142f Compare February 28, 2024 07:41
Copy link
Collaborator

@JuancaG05 JuancaG05 left a comment

Choose a reason for hiding this comment

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

Some more changes here @Aitorbp

@Aitorbp Aitorbp requested a review from JuancaG05 February 28, 2024 14:56
@Aitorbp Aitorbp force-pushed the feature/automatic_removal_downloaded_files_local_storage_clean_up branch from 4aa5879 to 4feb544 Compare February 28, 2024 15:16
Copy link
Collaborator

@JuancaG05 JuancaG05 left a comment

Choose a reason for hiding this comment

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

LGTM now!

@jesmrec
Copy link
Collaborator

jesmrec commented Feb 28, 2024

(1) [FIXED]

I noticed you removed the release notes from previous versions from the strings.xml file. That action can lead to compilation problems in release builds, because there are translation files in several languages that contain already translated strings like:

https://github.com/owncloud/android/blob/master/owncloudApp/src/main/res/values-de-rDE/strings.xml
https://github.com/owncloud/android/blob/master/owncloudApp/src/main/res/values-en-rGB/strings.xml

...and more.

Two options: either recovering the strings to string.xml or remove all legacy strings from all translated files.

IMO these actions are not related with the current PR, and should be done in separated place.

@jesmrec
Copy link
Collaborator

jesmrec commented Feb 28, 2024

(2) [FIXED]

kind of stupid question:

what's the best option to display: 24 hours or 1 day?

As reference, iOS app uses 1 day.

open question

@jesmrec
Copy link
Collaborator

jesmrec commented Feb 29, 2024

(3) [FIXED]

Another minor detail: in the description (Remove downloaded files automatically...), i'd add that available offline content is not removed.

Suggestion, open for discussion/improvement:

Remove automatically downloaded and temporary files that are not available offline, when the time since their last usage exceeds the selected time

Apart of that, you called "selected time" the option to be chosen by the user, so, i'd also call it in the selection line, instead of Current status:

What do you think?

Aitorbp added 3 commits March 4, 2024 10:46
…nTimeUseCase, OCFileRepository,LocalFileDataSource and FileDao
…Files in vm, handling prefDeleteLocalFiles in fragment, added component in xml and string
@Aitorbp Aitorbp force-pushed the feature/automatic_removal_downloaded_files_local_storage_clean_up branch from 59f2f64 to aa43a74 Compare March 4, 2024 10:47
@jesmrec
Copy link
Collaborator

jesmrec commented Mar 5, 2024

(4) [FIXED]

Some regards about the /tmp cleaning up. In /tmp folder are stored those files that are being uploaded. They are pushed to the server from that location without remaining local copy.

The current behaviour cleans totally up the /tmp folder, so that, if there are failed uploads, they are removed from there. What happens if the worker removes the /tmp files corresponding to a failed upload:

  • If the error was caused by a lack of connection and then retried, file is uploaded but with 0B and not reproducible ❌
  • If the error was caused by any other error, the retries cause a Folder Error ❌ , non recoverable
  • The worst case is Auto-Uploads with remove behaviour. In that case, the retries cause a Folder Error (non recoverable), and in addition, the original file is lost. So, we are talking about a data loss ❌ ❌ ❌ .

Also, in every case, files are removed from the internal storage but not from DB. This is not critical but could make the DB grow in uncontrolled way.

My suggested solutions are:

  1. Not cleaning the /tmp: In any case, users have the choice of removing failed uploads with CLEAR option in the uploads view.
  2. Remove everything also from BD
  3. Cleaning only the finished uploads from storage and DB together. It sounds like a DB cleaning

I like 1. the most. So, the final scope would be the real storage itself. I know that all the mentioned cases are pretty corner cases, but if conditions happen it could break the app. And data loss is never valid.

@Aitorbp Aitorbp force-pushed the feature/automatic_removal_downloaded_files_local_storage_clean_up branch from ca3855a to a67d598 Compare March 5, 2024 14:18
@jesmrec
Copy link
Collaborator

jesmrec commented Mar 5, 2024

My suggested solutions are:

Not cleaning the /tmp: In any case, users have the choice of removing failed uploads with CLEAR option in the uploads view.
Remove everything also from BD
Cleaning only the finished uploads from storage and DB together. It sounds like a DB cleaning

Taken solution was 1). In this iteration, /tmp will not be cleaned up to avoid mess with the failed uploads. Uploads can be handled in the uploads view, by cleaning the lists, the content in the /tmp is also cleaned up but one case: when an upload fails for a reason that is not a connection fail, retries are not removing files from /tmp, even with successful outcome.

That problem will be moved to another issue inside the epic.

For the current PR, it's approved on my side.

@Aitorbp Aitorbp requested a review from JuancaG05 March 6, 2024 08:02
@Aitorbp Aitorbp merged commit 28a602d into master Mar 6, 2024
5 checks passed
@Aitorbp Aitorbp deleted the feature/automatic_removal_downloaded_files_local_storage_clean_up branch March 6, 2024 09:26
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.

[FEATURE REQUEST] Automatic removal of downloaded files and local storage clean up
3 participants