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

Skip download if file already present #6

Open
jsquyres opened this issue Jul 25, 2023 · 0 comments
Open

Skip download if file already present #6

jsquyres opened this issue Jul 25, 2023 · 0 comments

Comments

@jsquyres
Copy link
Contributor

Problem Statement

It would be great if grabit did not actually download anything if the correct file is already present in the target directory.

Proposed Solution

Check the target download directory and see if the file is present. If it is, validate its checksum. If it validates, don't do the download.

If either the file is missing or its checksum fails to validate, do the download as normal.

Alternatives Considered

The only downside that I can think of is that there is a scenario where this "check and see if I need to download" scheme would actually take longer:

  1. grabit sees that a target file foo is present in the target directory
  2. grabit reads the file and computes the checksum
  3. the checksum does not validate
  4. grabit downloads a fresh copy of the file
  5. grabit reads the file and computes the checksum

In this scenario, grabit has to read the file twice and compute its checksum twice. If the file is large, this could be costly. But this may be a rare enough case not to worry about.

Additional Context

This is a minor optimization, but it would be helpful in repetitive developer scenarios (e.g., multiple builds in a row) where grabit may be in the main build code path.

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

1 participant