mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
RemoteCatalog refresh throws now
This commit is contained in:
@@ -743,7 +743,7 @@ _.extend(RemoteCatalog.prototype, {
|
||||
|
||||
buildmessage.assertInCapture();
|
||||
if (self.offline)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (options.maxAge) {
|
||||
var lastSync = self.getMetadata(METADATA_LAST_SYNC);
|
||||
@@ -751,29 +751,21 @@ _.extend(RemoteCatalog.prototype, {
|
||||
if (lastSync && lastSync.timestamp) {
|
||||
if ((Date.now() - lastSync.timestamp) < options.maxAge) {
|
||||
Console.debug("Catalog is sufficiently up-to-date; not refreshing\n");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var updateResult = {};
|
||||
var connectionFailed = false;
|
||||
try {
|
||||
buildmessage.enterJob({ title: 'Refreshing package metadata.' }, function () {
|
||||
updateResult = packageClient.updateServerPackageData(self);
|
||||
});
|
||||
} catch (err) {
|
||||
packageClient.handlePackageServerConnectionError(err);
|
||||
connectionFailed = true;
|
||||
}
|
||||
buildmessage.enterJob({ title: 'Refreshing package metadata.' }, function () {
|
||||
updateResult = packageClient.updateServerPackageData(self);
|
||||
});
|
||||
|
||||
if (connectionFailed) {
|
||||
Console.warn("Warning: could not connect to package server\n");
|
||||
}
|
||||
if (updateResult.resetData) {
|
||||
tropohouse.default.wipeAllPackages();
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
// Given a release track, return all recommended versions for this track, sorted
|
||||
|
||||
@@ -96,11 +96,9 @@ var loadRemotePackageData = function (conn, syncToken, _optionsForTest) {
|
||||
// - useShortPages: Boolean. Request short pages of ~3 records from the
|
||||
// server, instead of ~100 that it would send otherwise
|
||||
exports.updateServerPackageData = function (dataStore, options) {
|
||||
var results;
|
||||
buildmessage.capture({ title: 'Updating package catalog' }, function () {
|
||||
results = _updateServerPackageData(dataStore, options);
|
||||
return buildmessage.enterJob({ title: 'Updating package catalog' }, function () {
|
||||
return _updateServerPackageData(dataStore, options);
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
|
||||
@@ -139,20 +137,10 @@ _updateServerPackageData = function (dataStore, options) {
|
||||
(syncToken.versions - start.versions);
|
||||
buildmessage.reportProgress(state);
|
||||
|
||||
var remoteData;
|
||||
try {
|
||||
remoteData = loadRemotePackageData(conn, syncToken, {
|
||||
useShortPages: options.useShortPages
|
||||
});
|
||||
} catch (err) {
|
||||
exports.handlePackageServerConnectionError(err);
|
||||
if (err.errorType === "DDP.ConnectionError") {
|
||||
done = true;
|
||||
return;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
// (loadRemotePackageData may throw)
|
||||
var remoteData = loadRemotePackageData(conn, syncToken, {
|
||||
useShortPages: options.useShortPages
|
||||
});
|
||||
|
||||
// Is the remote server telling us to ignore everything we've heard before?
|
||||
// OK, we can do that.
|
||||
|
||||
Reference in New Issue
Block a user