Give appstore sometime to catch up on new release
This commit is contained in:
parent
e54fe1e34d
commit
f0bc1391f6
@ -11,7 +11,7 @@ exports = module.exports = {
|
|||||||
getOwner: getOwner,
|
getOwner: getOwner,
|
||||||
};
|
};
|
||||||
|
|
||||||
var gNow = (new Date()).getTime().toString();
|
var gNow = ((new Date()).getTime() / 1000).toFixed();
|
||||||
|
|
||||||
function cloudronDomain(filename) {
|
function cloudronDomain(filename) {
|
||||||
return 't-' + path.basename(filename, '-test.js') + '-' + gNow + '.smartserver.io';
|
return 't-' + path.basename(filename, '-test.js') + '-' + gNow + '.smartserver.io';
|
||||||
|
@ -29,15 +29,21 @@ function start() {
|
|||||||
function runTestsIfNeeded(callback) {
|
function runTestsIfNeeded(callback) {
|
||||||
debug('Getting latest box version');
|
debug('Getting latest box version');
|
||||||
|
|
||||||
getLatestBoxVersion(function (error, latestETag, latestBoxVersion) {
|
getLatestBoxVersion(function (error, latestETag, latestBoxVersion, lastModified) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|
||||||
if (latestETag === gLatestETag) {
|
if (latestETag === gLatestETag) {
|
||||||
debug('Box version has not changed. etag %s', gLatestETag);
|
debug('Box version has not changed. etag %s', gLatestETag);
|
||||||
return callback(null);
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('Box version has changed. etag %s', latestETag);
|
debug('Box version has changed. etag %s lm:%s', latestETag, lastModified);
|
||||||
|
|
||||||
|
var diff = (new Date() - lastModified);
|
||||||
|
if (diff < 3 * 60 * 1000) { // give appstore 3 mins
|
||||||
|
debug('Waiting for appstore gets the new release. diff=%s', diff);
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
runTests(latestETag, latestBoxVersion, function (error) {
|
runTests(latestETag, latestBoxVersion, function (error) {
|
||||||
debug('Finished running tests for etag %s: %s', latestETag, error);
|
debug('Finished running tests for etag %s: %s', latestETag, error);
|
||||||
@ -57,10 +63,11 @@ function getLatestBoxVersion(callback) {
|
|||||||
|
|
||||||
var latestVersion = Object.keys(res.body).sort(semver.rcompare)[0];
|
var latestVersion = Object.keys(res.body).sort(semver.rcompare)[0];
|
||||||
var latestETag = res.headers['etag'];
|
var latestETag = res.headers['etag'];
|
||||||
|
var lastModified = new Date(res.headers['last-modified']);
|
||||||
|
|
||||||
debug('%j:', res.headers);
|
debug('%j:', res.headers);
|
||||||
|
|
||||||
callback(null, latestETag, latestVersion);
|
callback(null, latestETag, latestVersion, lastModified);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user