-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make bower concurrent friendly, fixes #933 #1211
Conversation
Thank you for this patch! We'll be taking a look at this in a bit. We've got a bit of a back log at the moment, to it might take a while. Your patience is appreciated 🍌 |
|
||
// Check if directory exists | ||
// Check if destination directory exists to prevent issuing lock at all times | ||
return Q.nfcall(fs.stat, dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I think about it there is one scenario that can go wrong here:
- One worker checks that destination cache doesn't exist and begins copying from tmp
- Second worker checks that destination exists and returns cache location
- While first worker have not finished moving tmp to cache, second worker copies cache to bower_components, copying only half of files or so.
This is given bower doesn't wait for all downloads to be finished before copying them to bower_components.
If bower first resolves all downloads and only then copies to bower_components, it is not a problem.
If it doesn't wait, the solution is to use write lock at all times and remove this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see from source that bower waits with dissection until all packages are fetched.
So it should be ok..
Additionally the This means the I suggest removing Unfortunately bower cannot not use cache right now (it always copies from cache to bower_components, even if |
@sheerun seems reasonable. If you want, open a PR on that. Seems good. |
We need at least version 1.3.2 to avoid a race condition: bower/bower#1211 bower/bower#933 https://www.openproject.org/work_packages/5645 Signed-off-by: Alex Coles <[email protected]>
Read my comment: #933 (comment)
This is the only reasonable solution to concurrency issues in bower.