-
-
Notifications
You must be signed in to change notification settings - Fork 7k
improve already downloaded contribution file check #2865
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
Conversation
When downloading a file, it's possible that a corrupted archive could be bigger, smaller, or the same size as a non-corrupted archive, so it is not good to rely on the archive file size. Instead, the checksum can be used to verify if the already downloaded file is viable for reuse.
With this patch you remove the chance to resume downloads.
Not exactly, from the index.json we know size and checksum in advance, so we have three possibilities:
|
@cmaglie Thank you for reviewing my PR. I agree that we can get a bit of performance by checking the size, so I will update it to do that. I do not understand how my changes remove the chance to resume downloads, if that chance previously existed. I didn't realize it had the feature of resuming downloads though, so that makes the name Does the code currently allow for resuming partially completed downloads? How does the download resuming work? |
Hi @ryantm, yeah, sorry, indeed your PR doesn't break the resume I was misleaded by the fact that The Now going back to your PR it seems to do:
so, in case the file is already downloaded the CRC is checked twice. I guess that the Also I'll rename How does it sounds? |
…rformance Renamed alreadyDownloadedFileViable to fileAlreadyDownloaded to better reflect what is going on with the download Added file length check to improve performance Reordered the logic of DownloadableContributionsDownloader.download to avoid doing multiple checksums in the case of a good file
Honestly I'm missing the purpose of this PR: what is the problem are you trying to solve exactly? |
Closing for lack of feedback |
When downloading a file, it's possible that a corrupted archive could be
bigger, smaller, or the same size as a non-corrupted archive, so it is
not good to rely on the archive file size. Instead, the checksum can be
used to verify if the already downloaded file is viable for reuse.