take it slow
This commit is contained in:
parent
0d5a2fbf16
commit
05c522ea9b
12
appstore.js
12
appstore.js
@ -59,8 +59,8 @@ AppStore.prototype.waitForIP = function (boxId) {
|
||||
|
||||
var res;
|
||||
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(20);
|
||||
process.stdout.write('.');
|
||||
res = request.get(this._origin + '/api/v1/cloudrons/' + boxId).query({ accessToken: this._credentials.accessToken }).end();
|
||||
common.verifyResponse2xx(res, 'Could not query cloudron status');
|
||||
@ -85,7 +85,7 @@ AppStore.prototype.waitForCloudron = function (boxId) {
|
||||
var boxInfo = null, res;
|
||||
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(10);
|
||||
sleep(20);
|
||||
process.stdout.write('.');
|
||||
res = request.get(this._origin + '/api/v1/cloudrons/' + boxId).query({ accessToken: this._credentials.accessToken }).end();
|
||||
common.verifyResponse2xx(res, 'Could not query cloudron status');
|
||||
@ -104,7 +104,7 @@ AppStore.prototype.waitForCloudron = function (boxId) {
|
||||
// even if the cloudron sent heartbeat to appstore, doesn't mean we can contact the cloudron thanks to DO networking insanity
|
||||
process.stdout.write('Waiting for Cloudron to be reachable.');
|
||||
for (i = 0; i < 60; i++) {
|
||||
sleep(10);
|
||||
sleep(20);
|
||||
process.stdout.write('.');
|
||||
res = request.get('https://' + boxInfo.ip).end();
|
||||
if (!res.error) break;
|
||||
@ -135,10 +135,10 @@ AppStore.prototype.deleteCloudron = function (box) {
|
||||
common.verifyResponse2xx(res, 'Could not delete cloudron');
|
||||
|
||||
process.stdout.write('Waiting for Cloudron to disappear.');
|
||||
for (var i = 0; i < 40; i++) {
|
||||
for (var i = 0; i < 60; i++) {
|
||||
if (this.getCloudron(box.id) === null) return;
|
||||
|
||||
sleep(10);
|
||||
sleep(20);
|
||||
|
||||
process.stdout.write('.');
|
||||
}
|
||||
|
32
cloudron.js
32
cloudron.js
@ -93,8 +93,8 @@ Cloudron.prototype.activate = function (user) {
|
||||
|
||||
////////// activation
|
||||
var res;
|
||||
for (var i = 0; i < 40; ++i) {
|
||||
sleep(5);
|
||||
for (var i = 0; i < 60; ++i) {
|
||||
sleep(20);
|
||||
|
||||
res = request.post(this._origin + '/api/v1/cloudron/activate').query({ setupToken: setupToken }).send(user).end();
|
||||
|
||||
@ -120,7 +120,7 @@ Cloudron.prototype.waitForApp = function (appId) {
|
||||
|
||||
var res;
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(10);
|
||||
sleep(20);
|
||||
process.stdout.write('.');
|
||||
res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).end();
|
||||
common.verifyResponse2xx(res, 'Could not query app status');
|
||||
@ -141,8 +141,8 @@ Cloudron.prototype.waitForApp = function (appId) {
|
||||
Cloudron.prototype.waitForBox = function () {
|
||||
process.stdout.write('Waiting for box.');
|
||||
var res;
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(20);
|
||||
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
||||
if (res.statusCode === 200) {
|
||||
console.log();
|
||||
@ -203,8 +203,8 @@ Cloudron.prototype.uninstallApp = function (appId) {
|
||||
var res = request.post(this._origin + '/api/v1/apps/' + appId + '/uninstall').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
||||
common.verifyResponse2xx(res, 'Cannot uninstall app');
|
||||
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(20);
|
||||
process.stdout.write('.');
|
||||
res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).retry(0).end();
|
||||
if (res.statusCode === 404) {
|
||||
@ -236,8 +236,8 @@ Cloudron.prototype.updateApp = function (appId, newManifest) {
|
||||
Cloudron.prototype.update = function (toVersion) {
|
||||
process.stdout.write('Trying to update');
|
||||
var res;
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(20);
|
||||
process.stdout.write('.');
|
||||
res = request.post(this._origin + '/api/v1/cloudron/update').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
||||
if (res.statusCode === 422) continue; // box has not seen the update yet
|
||||
@ -248,8 +248,8 @@ Cloudron.prototype.update = function (toVersion) {
|
||||
|
||||
console.log('Update started'.green);
|
||||
process.stdout.write('Waiting for update.');
|
||||
for (i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
for (i = 0; i < 60; i++) {
|
||||
sleep(20);
|
||||
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
||||
if (res.statusCode === 200 && res.body.version === toVersion) {
|
||||
console.log();
|
||||
@ -292,8 +292,8 @@ Cloudron.prototype.backup = function () {
|
||||
res = request.post(this._origin + '/api/v1/backups').query({ access_token: this._credentials.accessToken }).end();
|
||||
common.verifyResponse2xx(res, 'Could not schedule backup');
|
||||
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10); // backup sometimes takes a while to start
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(20); // backup sometimes takes a while to start
|
||||
res = request.get(this._origin + '/api/v1/cloudron/progress').end();
|
||||
if (res.body.backup === null || res.body.backup.percent === 100) {
|
||||
debug('backup done');
|
||||
@ -302,7 +302,7 @@ Cloudron.prototype.backup = function () {
|
||||
debug('Backing up: %s %s', res.body.backup.percent, res.body.backup.message);
|
||||
}
|
||||
|
||||
if (i === 40) throw new Error('backup: timedout');
|
||||
if (res.body.backup !== null && res.body.backup.percent !== 100) throw new Error('backup: timedout');
|
||||
|
||||
res = request.get(this._origin + '/api/v1/backups').query({ access_token: this._credentials.accessToken }).end();
|
||||
common.verifyResponse2xx(res, 'Could not get backups');
|
||||
@ -344,8 +344,8 @@ Cloudron.prototype._checkGraphs = function (targets, from) {
|
||||
};
|
||||
|
||||
var res;
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
sleep(20);
|
||||
res = request.get(this._origin + '/api/v1/cloudron/graphs').query(params).end();
|
||||
process.stdout.write('.');
|
||||
if (res.statusCode !== 200) continue;
|
||||
|
Loading…
Reference in New Issue
Block a user