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

Atomically write downloaded file to filesystem #3

Merged
merged 1 commit into from
Jun 30, 2024
Merged

Conversation

hryx
Copy link
Contributor

@hryx hryx commented Jun 26, 2024

This prevents writing a truncated file to a valid cache path, and serving that partial file later.

This uses a new dependency, github.com/natefinch/atomic, which, from a quick look, seems to do the right thing.

I manually tested stopping the server mid-download and only complete files (builds, tarballs, and minisigs) existed in the cache, no truncated files. Upon a second download attempt, the remaining architectures were fetched and cached as usual.

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

This prevents writing a truncated file to a valid cache path, and
serving that partial file later.

This uses a new dependency, github.com/natefinch/atomic, which from a
quick look seems to do the right thing.
Copy link
Member

@emidoots emidoots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for this!

@emidoots emidoots merged commit 625a583 into hexops:main Jun 30, 2024
1 check failed
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

Successfully merging this pull request may close these issues.

2 participants