-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Resumable download #400
Resumable download #400
Conversation
…n case of crash or app closing during update
💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe. |
Thanks for the work, this should be done in Android and IOS, can you work on the ios side? |
Hi, I'm currently working on it |
0ac684a
to
37efd56
Compare
Just added resumable download for iOS in 37efd56 You can see the video : https://www.youtube.com/watch?v=_QO9jNQHbIQ |
android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java
Outdated
Show resolved
Hide resolved
Hey @riderx 👋! I don't see a sibling PR from the author for the Regarding my earlier comment:
|
… download the full file
@ayewo you are correct we now extended the validity of the zip as it was required for other cache test. |
Hi @YanisOUALAN, can you please provide step-by-step instructions that can be used to verify your implementation works as desired? Including the demo app you used for testing would be nice too. Thanks! |
Hey, sure, To setup the demo app:
Install my version of capgo :
Create a bundle for triggering the update :
For testing (iOS and Android) :The termination (SIGKILL) scenario :
The disconnected scenario :
The app closed scenario :
I suggest to add these lines to facilitate the debugging in
And on
In order to show the download progress I also recommend using a network throttler like NetLimiter for Windows or Network Link Conditioner for MacOS so you can slow down the download progress artificially, otherwise it will happen too quickly before you can try to stop it. If the download happened and your app got updated and you want to test the downloading process again, just go to package.json in the demo app folder, and change Let me know if you have any question ! |
Hey @ayewo do you have time to test it ? |
Hey @riderx Sorry for the delay. If it's not too late, I should have some availability to review it either tomorrow or Saturday, God willing. |
Yes it's good for us ! i will make it good pay as well as it's important |
android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java
Outdated
Show resolved
Hide resolved
Have you guys managed to test my implementation ? Let me know if you have any issues 😉 ! |
@YanisOUALAN almost, @ayewo is sick it should be back soon |
ios/Plugin/CapacitorUpdater.swift
Outdated
let semaphore: DispatchSemaphore = DispatchSemaphore(value: 0) | ||
let id: String = self.randomString(length: 10) | ||
var checksum: String = "" | ||
//Do a GET request on the url in order to extract the Content-Length header, ask only for the 10 first bytes in order to not download the full content. |
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.
I believe that you could use a "head" request in order to get the content-length. As far as I know we do that here
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.
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.
We do head request just here: https://github.com/Cap-go/capgo/blob/ebde1312a51feb6288ea5be750df71f3399cab46/supabase/functions/_backend/utils/s3.ts#L116
To get the size.
Just after getSignedUrl who is the function used to respond to the update (what you are getting), so it should work
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.
Please let me know if I'm missing anything. I attempted to use a HEAD
request to retrieve the Content-Length
header, but I kept receiving a 403
error, which suggests that the download URL may not support HEAD
requests. To address this issue, in commit 90a09dd, I modified my GET
request logic to include Range: bytes=0-0
. This adjustment ensures that my GET
request is basically the same as a HEAD
request, effectively retrieving only the first byte and providing the necessary headers.
@riderx I don't think that it's the case. I have not observed this behavior for a long while now. Currently I strongly believe that |
@riderx we MUST start unifying the code base. This is a great opportunity to fix the download_%. |
The thing about the download % is that we have NO WAY of knowing that it's going to be a multiple of 10.
I think that they are perfectly valid and that we should set them as a |
7cfa2ad
to
cceed89
Compare
|
Alright, I would say that IOS is quite nicely polished. The one thing that is left in IOS is figuring out the |
As a possible solution, we could ensure every 10% milestone is recorded once a chunk completes. For instance, for a reported percent: 53, we would send :
if tracking precise milestones is crucial. |
We could, ultimately this decision is up to Martin. Personally, i believe in sending it the way I proposed mostly because it conveys more information. If you see download in regular intervals (10, 20, 30) it means that the download is likely slow. If you see skips in the download (20 -> 50) that means that your bundle is really small and that it gets downloaded quickly |
@WcaleNieWolny i’m not sure to understand what you mean by it doesn’t work since long i see the events everyday in many users, i helped a customer yesterday with that. |
@riderx here is the issue explained in details 2024-08-17.16-03-18.mp4 |
Current system do send only for ten X percent so we want the same. |
Hey @YanisOUALAN do you confirm your proposal was implemented? |
If not can you please do a quick PR to fix it, i didn’t saw it was missing |
Hello, it wasn't implemented when this PR was merged since I didn't had confirmation if the behavior i suggested was the one needed, i am going to make another commit to implement my proposal later this day or tomorrow 👍 |
Thanks 🙏 |
The issue reported is in android, did you had it working on android ? |
I merged your fix in ios |
It did work, but the user reported that he used the 5.9.5 version, so I doubt that it's related to this PR |
ok great thanks i will check with the user |
@YanisOUALAN I think there is something odd: Cap-go/capgo#804 |
I don't remember changing anything about the signature, i am going to invest about this problem if you want |
@YanisOUALAN i think i found out and fixed it, it came from merge i think |
Oh okay, i applied a fix in #437, but if it has been resolved, then we can just close it i guess |
For Android and iOS :
This pull request introduces a resumable download feature to the updater, addressing the issue reported in #255.
The new functionality ensures that if the application is closed, receives a SIGKILL signal, or crashes during an update, the update process will resume from the last completed point the next time the application is launched.
This enhancement aims to provide a more robust update experience by mitigating the impact of disruptions during the update process while reducing bandwidth usage.
You can see it in action here : https://www.youtube.com/watch?v=Y-MFS3PfmCc
Let me know if any question !
/claim #255