mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
fix forgottenECVs and reduce refresh rate
Two things:
- to determine if two versions are compatible, we need to know their ECVs. (earliest
compatible versions). If the version that we have is local, then we don't have access to the
version record of the server version, so we can't figure out its ECV. That's why in the olden
days, there was a hack to store ECVs separately ('forgotten ECVs'). The new catalog didn't
have that function implemented -- it might not need it, but in that case, it would need to make
changes to the constraint solver that might be risky at this point. In any case, implementing this
function in the new world is pretty easy and solves the problem for now.
- when we look for things, we look in the local catalog, then the server catalog and if the server
catalog can't find it, it will refresh. However, sometimes, we are looking for something that the
server catalog cannot POSSIBLY have (ie: it has a build ID). That's fine, actually, but it causes
an extra refresh on the server catalog that we don't need. I put in a break to make sure that, if we
know for a fact that the server catalog does not have a version record (ie: it has a build id), we don't
bother looking in it and just return null to begin with. That should help.
This commit is contained in:
@@ -726,7 +726,8 @@ _.extend(RemoteCatalog.prototype, {
|
||||
|
||||
getBuildWithPreciseBuildArchitectures: function (versionRecord, buildArchitectures) {
|
||||
var self = this;
|
||||
var matchingBuilds = this._queryAsJSON("SELECT content FROM builds WHERE versionId=?", versionRecord._id);
|
||||
var matchingBuilds = this._queryAsJSON(
|
||||
"SELECT content FROM builds WHERE versionId=?", versionRecord._id);
|
||||
return _.findWhere(matchingBuilds, { buildArchitectures: buildArchitectures });
|
||||
},
|
||||
|
||||
|
||||
@@ -42,10 +42,6 @@ var LayeredCatalog = function() {
|
||||
// Constraint solver using this catalog.
|
||||
self.resolver = null;
|
||||
|
||||
// See the documentation of the _extraECVs field in ConstraintSolver.Resolver.
|
||||
// Maps packageName -> version -> its ECV
|
||||
self.forgottenECVs = {};
|
||||
|
||||
// Each complete catalog needs its own package cache.
|
||||
self.packageCache = new packageCache.PackageCache(self);
|
||||
};
|
||||
@@ -101,7 +97,14 @@ _.extend(LayeredCatalog.prototype, {
|
||||
},
|
||||
|
||||
getForgottenECVs: function (packageName) {
|
||||
return this.forgottenECVs[packageName];
|
||||
var self = this;
|
||||
var versions = self.otherCatalog.getSortedVersions(packageName);
|
||||
var forgottenECVs = {};
|
||||
_.each(versions, function (v) {
|
||||
var vr = self.otherCatalog.getVersion(packageName, v);
|
||||
forgottenECVs[v] = vr.earliestCompatibleVersion;
|
||||
});
|
||||
return forgottenECVs;
|
||||
},
|
||||
|
||||
getLoadPathForPackage: function (name, version, constraintSolverOpts) {
|
||||
@@ -147,7 +150,15 @@ _.extend(LayeredCatalog.prototype, {
|
||||
},
|
||||
|
||||
getVersion: function (name, version) {
|
||||
return this._returnFirst("getVersion", arguments, ACCEPT_NON_EMPTY);
|
||||
var self = this;
|
||||
var result = self.localCatalog.getVersion(name, version);
|
||||
if (!result) {
|
||||
if (/\+/.test(version)) {
|
||||
return null;
|
||||
}
|
||||
result = self.otherCatalog.getVersion(name, version);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
Reference in New Issue
Block a user