mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
misc
This commit is contained in:
@@ -49,10 +49,6 @@ var LocalCatalog = function (options) {
|
||||
|
||||
self.packageSources = null;
|
||||
self.built = null;
|
||||
|
||||
//???? PASCAL Do we need those
|
||||
self.refreshing = false;
|
||||
self.needRefresh = false;
|
||||
};
|
||||
|
||||
_.extend(LocalCatalog.prototype, {
|
||||
@@ -205,7 +201,7 @@ _.extend(LocalCatalog.prototype, {
|
||||
// one, in case our local cache says "version exists but only for the wrong
|
||||
// arch" and the right arch has been recently published.
|
||||
// XXX should ensure at most one refresh
|
||||
// PASCAL - check with Ekate
|
||||
// PASCAL - check with Ekate that it is ok to not explicitely refresh again
|
||||
var allBuilds = _.where(self.builds, { versionId: versionInfo._id });
|
||||
var solution = null;
|
||||
utils.generateSubsetsOfIncreasingSize(allBuilds, function (buildSubset) {
|
||||
@@ -278,18 +274,9 @@ _.extend(LocalCatalog.prototype, {
|
||||
// and self.localPackages.
|
||||
_recomputeEffectiveLocalPackages: function () {
|
||||
var self = this;
|
||||
// console.log("refrehsing for " + self.localPackageDirs);
|
||||
|
||||
self.effectiveLocalPackages = _.clone(self.localPackages);
|
||||
|
||||
//PASCAL Does this still applies?
|
||||
// XXX If this is the forUniload catalog, we should only consider
|
||||
// uniload.ROOT_PACKAGES and their dependencies. Unfortunately, that takes a
|
||||
// fair amount of refactoring (since we don't know dependencies until we
|
||||
// start reading them). So for now, the uniload catalog (in checkout mode)
|
||||
// does include information about all the packages in the meteor repo, not
|
||||
// just the ones that can be uniloaded. (But it doesn't contain information
|
||||
// about app packages!)
|
||||
_.each(self.localPackageDirs, function (localPackageDir) {
|
||||
if (! utils.isDirectory(localPackageDir))
|
||||
return;
|
||||
|
||||
@@ -168,7 +168,8 @@ _.extend(RemoteCatalog.prototype, {
|
||||
future.wait();
|
||||
},
|
||||
|
||||
purgeDB: function () {
|
||||
// This function empties the DB. This is called from the package-client.
|
||||
reset: function () {
|
||||
var self = this;
|
||||
var future = new Future;
|
||||
self.db.serialize(function() {
|
||||
@@ -214,7 +215,7 @@ _.extend(RemoteCatalog.prototype, {
|
||||
}
|
||||
if (updateResult.resetData) {
|
||||
tropohouse.default.wipeAllPackages();
|
||||
self.purgeDB();
|
||||
self.reset();
|
||||
}
|
||||
|
||||
},
|
||||
@@ -261,10 +262,10 @@ _.extend(RemoteCatalog.prototype, {
|
||||
return false;
|
||||
},
|
||||
|
||||
_queryWithRetry: function (query, values) {
|
||||
_queryWithRetry: function (query, values, options) {
|
||||
var self = this;
|
||||
var result = self._justQuery(query, values);
|
||||
if (result.length !== 0)
|
||||
if ( result.length !== 0 || ( options && options.noRetry ) )
|
||||
return result;
|
||||
self.refresh();
|
||||
return self._justQuery(query, values);
|
||||
@@ -291,8 +292,8 @@ _.extend(RemoteCatalog.prototype, {
|
||||
|
||||
// Execute a query using the values as arguments of the query and return the result as JSON.
|
||||
// This code assumes that the table being queried always have a column called "entity"
|
||||
_queryAsJSON: function (query, values) {
|
||||
var rows = this._queryWithRetry(query, values);
|
||||
_queryAsJSON: function (query, values, options) {
|
||||
var rows = this._queryWithRetry(query, values, options);
|
||||
return _.map(rows, function(entity) {
|
||||
return JSON.parse(entity.content);
|
||||
});
|
||||
@@ -381,7 +382,7 @@ _.extend(RemoteCatalog.prototype, {
|
||||
|
||||
getSyncToken : function() {
|
||||
var self = this;
|
||||
var result = self._queryAsJSON("SELECT content FROM syncToken", []);
|
||||
var result = self._queryAsJSON("SELECT content FROM syncToken", [], { noRetry: true });
|
||||
if (!result || result.length === 0)
|
||||
return {};
|
||||
delete result[0]._id;
|
||||
|
||||
Reference in New Issue
Block a user