Don't run the npm downloads in parallel

Seems to break. We should fix this properly in future, for a better dev UX
This commit is contained in:
Justin SB
2014-09-30 11:45:58 -07:00
parent 6feeed3cf1
commit f0a12fd37d
3 changed files with 54 additions and 33 deletions

View File

@@ -505,42 +505,62 @@ var forkJoin = function (options, iterable, fn) {
var messageSet = currentMessageSet.get();
var progress = currentProgress.get();
_.each(iterable, function (/*arguments*/) {
var fut = new Future();
var fnArguments = arguments;
Fiber(function () {
currentProgress.withValue(progress, function () {
currentMessageSet.withValue(messageSet, function () {
currentJob.withValue(job, function () {
try {
var result = enterJob({title: (options.title || '') + ' child' }, function () {
return fn.apply(null, fnArguments);
});
fut['return'](result);
} catch (e) {
fut['throw'](e);
}
var parallel = (options.parallel !== undefined) ? options.parallel : true;
if (parallel) {
_.each(iterable, function (/*arguments*/) {
var fut = new Future();
var fnArguments = arguments;
Fiber(function () {
currentProgress.withValue(progress, function () {
currentMessageSet.withValue(messageSet, function () {
currentJob.withValue(job, function () {
try {
var result = enterJob({title: (options.title || '') + ' child' }, function () {
return fn.apply(null, fnArguments);
});
fut['return'](result);
} catch (e) {
fut['throw'](e);
}
});
});
});
});
}).run();
futures.push(fut);
});
}).run();
futures.push(fut);
});
_.each(futures, function (future) {
try {
var result = future.wait();
results.push(result);
errors.push(null);
} catch (e) {
results.push(null);
errors.push(e);
_.each(futures, function (future) {
try {
var result = future.wait();
results.push(result);
errors.push(null);
} catch (e) {
results.push(null);
errors.push(e);
if (firstError === null) {
firstError = e;
if (firstError === null) {
firstError = e;
}
}
}
});
});
} else {
// not parallel
_.each(iterable, function (/*arguments*/) {
var fnArguments = arguments;
try {
var result = fn.apply(null, fnArguments);
results.push(result);
errors.push(null);
} catch (e) {
results.push(null);
errors.push(e);
if (firstError === null) {
firstError = e;
}
}
});
}
});
if (firstError) {

View File

@@ -456,7 +456,8 @@ _.extend(LocalCatalog.prototype, {
};
// Load the package sources for packages and their tests into packageSources.
buildmessage.forkJoin({ 'title': 'Initializing packages'}, self.effectiveLocalPackages, function (x) {
// XXX: We should make this work with parallel: true; right now it seems to hit node problems
buildmessage.forkJoin({ 'title': 'Initializing packages', parallel: false }, self.effectiveLocalPackages, function (x) {
initSourceFromDir(x);
});

View File

@@ -311,7 +311,7 @@ _.extend(exports.Tropohouse.prototype, {
options = options || {};
var serverArch = options.serverArch || archinfo.host();
var downloadedPackages = {};
buildmessage.forkJoin({ title: 'Downloading packages'},
buildmessage.forkJoin({ title: 'Downloading packages', parallel: true },
versionMap, function (version, name) {
try {
self.maybeDownloadPackageForArchitectures({