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 🍌 |
There was a problem hiding this comment.
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.
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 <alex@alexbcoles.com>
Read my comment: #933 (comment)
This is the only reasonable solution to concurrency issues in bower.