speed up legacy springboarding

after the first time you springboard to a legacy release, don't refresh
the catalog before springboarding
This commit is contained in:
David Glasser
2014-08-06 16:02:33 -07:00
parent 215a6a15c2
commit 215872fea2
2 changed files with 18 additions and 0 deletions

View File

@@ -776,6 +776,17 @@ Fiber(function () {
}
if (releaseName !== undefined) {
// First, if we know just by looking at our disk that this is a legacy
// pre-0.9.0 release, springboard to it immediately, before calling
// release.load (which will refresh the catalog because the release
// presumably doesn't exist on the new server, and this is a slow
// operation).
if (warehouse.releaseExistsInWarehouse(releaseName)) {
var manifest = warehouse.ensureReleaseExistsAndReturnManifest(
releaseName);
oldSpringboard(manifest.tools);
}
try {
var rel = release.load(releaseName);
} catch (e) {

View File

@@ -124,6 +124,13 @@ _.extend(warehouse, {
return fs.existsSync(warehouse.getToolsDir(version));
},
releaseExistsInWarehouse: function (version) {
var releasesDir = path.join(warehouse.getWarehouseDir(), 'releases');
var releaseManifestPath = path.join(releasesDir,
version + '.release.json');
return fs.existsSync(releaseManifestPath);
},
_calculateNewPiecesForRelease: function (releaseManifest) {
// newPieces.tools and newPieces.packages[PACKAGE] are either falsey (if
// nothing is new), or an object with keys "version" and bool