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

Adds flock for concurrent access #3

Merged
merged 1 commit into from
May 30, 2019

Conversation

xtuc
Copy link
Member

@xtuc xtuc commented May 30, 2019

Download does the following steps:

  1. defines a destination (return if already exists)
  2. download and extract in a temporary directory
  3. rename the temporary directory to the final destionation

Now imagine a concurrent install is running, if after the step 1. another
installation succedeed the rename (step 3.) will fail
(however, only under Linux because of different syscalls).

This change allows to acquire a lock before step 1 and release it
after step 3. Concurrent access will wait.

Fixes #2

Make sure these boxes are checked! 📦✅

  • You have the latest version of rustfmt installed
$ rustup component add rustfmt-preview --toolchain nightly
  • You ran cargo fmt on the code base before submitting
  • You reference which issue is being closed in the PR text

✨✨ 😄 Thanks so much for contributing to binary-install! 😄 ✨✨

Download does the following steps:
1. defines a destination (return if already exists)
2. download and extract in a temporary directory
3. rename the temporary directory to the final destionation

Now imagine a concurrent install is running, if after the step 1. another
installation succedeed the rename (step 3.) will fail
(however, only under Linux because of different syscalls).

This change allows to acquire a lock before step 1 and release it
after step 3. Concurrent access will wait.

Fixes rustwasm#2
@ashleygwilliams ashleygwilliams merged commit 3b13f9f into rustwasm:master May 30, 2019
@ashleygwilliams ashleygwilliams added this to the 0.0.3 milestone May 30, 2019
@xtuc xtuc deleted the feat-flock branch May 31, 2019 08:19
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.

Can't use in concurrence
2 participants