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

Redundant HTTP requests for the .zsync file #38

Open
DeeDeeG opened this issue Jan 2, 2019 · 2 comments
Open

Redundant HTTP requests for the .zsync file #38

DeeDeeG opened this issue Jan 2, 2019 · 2 comments

Comments

@DeeDeeG
Copy link
Contributor

DeeDeeG commented Jan 2, 2019

Hi,

As mentioned in #33...

the first 1024 bits of the remote .zsyncfile are requested twice, and then the full .zsync file is potentially requested twice as well.

@DeeDeeG
Copy link
Contributor Author

DeeDeeG commented Jan 2, 2019

Here's a more detailed breakdown of this bug.

For background, I think the program flow is something like this:

  • Grab first KB of .zsync file, which includes some useful metadata.
  • Read the pre-computed, known-good SHA1 hash of the payload from the .zsync file.
  • Compute actual SHA1 hash of the payload file on disk.
  • If they match, nothing left to do and program can exit.
  • If they don't match, download the full .zsync file.
  • (Use the full metadata to see what chunks we have locally, and which need to be downloaded from the remote server.)

At each of those steps where the .zsync file is downloaded, the request is doubled (the bug this issue is about).

And now after #39 has been merged, all four requests are for the full .zsync file.

@TheAssassin
Copy link
Member

We should redesign the whole handling of the .zsync file by downloading it once, caching and reusing it from there. The full download should only occur if necessary. We will probably need two variables, one that contains the contents of the file, and one that shows whether it's a partial or complete copy of the .zsync file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants