-
-
Notifications
You must be signed in to change notification settings - Fork 473
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
Fixes of Zim file does not download / pending forever #3451
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #3451 +/- ##
=============================================
- Coverage 48.68% 48.67% -0.01%
Complexity 1006 1006
=============================================
Files 285 285
Lines 10096 10095 -1
Branches 1348 1348
=============================================
- Hits 4915 4914 -1
Misses 4398 4398
Partials 783 783
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MohitMaliDeveloper @kelson42 LGTM! @MohitMaliDeveloper Thanks! Would be great if we added tests.
@MohitMaliDeveloper strongly disagree with this PR because what you have developed is a pause/resume feature without calling it appropriatly and hidding it behind the cancel feature. Basically a failed attempt to fix #2093. Naming things properly is the highest challeng in software engineering, by not doing so you have created new bugs…. And actually the PR does not match the bug reported first. @gouri-panda This PR ahould not have been approved. An example of bug: user download 1GB of data for a zim then want to cancel. He cancels… but now one temporary data of 1GB is on the disk and he has no way to recover that space. If he do that a few times, he can fill the disk with twmporary data! Now, @MohitMaliDeveloper please:
@MohitMaliDeveloper Does all of this make sense or do I’m missing aomething? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR does not only fix bug but introduce a feature without having discuss it properly.
@kelson42, Yes, we have implemented the pause/resume feature. I properly updated the PR description, taking reference from Gouri's comment to reduce extra network costs. However, I apologize for not updating the PR title. The main issue we addressed was when canceling a download from the notification, we used the fetch cancel function, which cancels the download. If we then attempt to download the same item again, the file is already present in storage and we end up with two download IDs for the same file in fetch. On the other hand, when canceling the download from the application, it deletes the download ID from fetch, which automatically removes the corresponding file from storage.
I agree with you. The memory occupied by the canceled download is not recoverable from within the application itself. The user can only recover that memory by manually deleting the file using a file manager.
In the current UI, when the user clicks on the cancel button, we show a dialog to confirm the cancellation of the download. We can enhance this dialog by adding a new button called "Pause." When the user clicks on the Pause button, the download will be paused, and we will update the UI to display a pause button instead of the stop button. If the user clicks on the pause button, we can show another dialog with two options: a) Show Paused Downloads at the Top: b) Create a Separate Screen for Paused Downloads: |
It's mandatory to always delete temporary file if download is canceled. If not always done, this is a bug and this is what has to be fixed here. For the rest, this should be done on appropriate ticket, not here. |
707914c
to
842a7ee
Compare
@kelson42, I have done the changes as you requested also updated the PR description. |
@gouri-panda can you please review again? |
@kelson42 Sorry, I didn't see this edge case. You made a good valid point. Storage is also our priority too. I agree with @MohitMaliDeveloper too, we should have pause, resume and cancel button use cases too. pause will allow to stop downloading files for a while. resume will allow start downloading from the previous state and cancel will allow stop the downloading & delete the whole file from the storage.
@MohitMaliDeveloper I think we have this ticket before. Perhaps this is a good time to remove the dependency of the fetch library. Also, we'll benefit the duplicate id problem you previously discussed. |
Not in favour of replacing Fetch now.... not a good timing for such a big change. |
@gouri-panda Thank you for the review. |
Fixes #3441
We encountered an issue where the download remained pending indefinitely if we canceled it from the notification. This happened because when we canceled the download by clicking the notification cancel button, it kept a reference in the fetch system. Consequently, if we tried to download the same file again, fetch created a new download ID, resulting in a conflict with the existing instance of the file. As a result, the download did not start.
However, when we canceled the download within the app itself, it deletes the instance from fetch, which automatically deletes the temporary file from storage.
To resolve this issue, we have made a change. Instead of using the CANCEL action, we now use the DELETE action. So, if the user cancels the download from the notification, it will function the same way as if they have canceled it from within the application.
downloadcancelfromnotificationissue.mp4