Fixed an infinite recursion bug

This commit is contained in:
Mat Scales
2013-11-22 13:40:04 +00:00
parent d24da615b3
commit d68d2a4b18

View File

@@ -371,6 +371,8 @@ Manager.prototype._failFast = function () {
};
Manager.prototype._parseDependencies = function (decEndpoint, pkgMeta, jsonKey) {
var pending = [];
decEndpoint.dependencies = decEndpoint.dependencies || {};
// Parse package dependencies
@@ -426,10 +428,7 @@ Manager.prototype._parseDependencies = function (decEndpoint, pkgMeta, jsonKey)
}, this);
if (compatible) {
compatible.promise
.then(function () {
this._parseDependencies(decEndpoint, pkgMeta, jsonKey);
}.bind(this));
pending.push(compatible.promise);
return;
}
}
@@ -442,6 +441,13 @@ Manager.prototype._parseDependencies = function (decEndpoint, pkgMeta, jsonKey)
childDecEndpoint.dependants = [decEndpoint];
this._fetch(childDecEndpoint);
}, this);
if (pending.length > 0) {
Q.all(pending)
.then(function () {
this._parseDependencies(decEndpoint, pkgMeta, jsonKey);
}.bind(this));
}
};
Manager.prototype._dissect = function () {