Merge pull request #134 from kitematic/jmorgan_fix_sync

Fixing sync bug where deleted container would re-appear after deletion
This commit is contained in:
Jeffrey Morgan 2014-12-09 23:09:10 -08:00
commit 9c483d8881
2 changed files with 17 additions and 17 deletions

View File

@ -67,10 +67,10 @@ AppUtil.stop = function (appId) {
AppUtil.remove = function (appId) {
var app = Apps.findOne(appId);
if (app.docker) {
Apps.remove({_id: appId});
Docker.removeContainer(app.docker.Id, function (err) {
var appPath = path.join(Util.KITE_PATH, app.name);
Util.deleteFolder(appPath);
Apps.remove({_id: appId});
});
} else {
Apps.remove({_id: appId});
@ -153,7 +153,7 @@ AppUtil.sync = function (callback) {
var diffApps = _.difference(guiIds, containerIds);
_.each(diffApps, function (appContainerId) {
var app = Apps.findOne({'docker.Id': appContainerId});
if (app) {
if (app && app.status !== 'STARTING') {
AppUtil.remove(app._id);
}
});

View File

@ -221,24 +221,24 @@ updateBoot2DockerUtilization = function (callback) {
});
};
startUpdatingBoot2DockerUtilization = function () {
updateBoot2DockerUtilization(function (err) {
if (err) {console.log(err);}
Meteor.setTimeout(startUpdatingBoot2DockerUtilization, 2000);
});
updateBoot2DockerUtilization(function (err) { if (err) {console.log(err);} });
Meteor.setTimeout(startUpdatingBoot2DockerUtilization, 2000);
};
startSyncingAppState = function () {
try {
ImageUtil.sync(function (err) {
if (err) {throw err;}
AppUtil.sync(function (err) {
if (err) {throw err;}
Meteor.setTimeout(startSyncingAppState, 2000);
});
console.log('app');
ImageUtil.sync(function (err) {
if (err) {
console.log(err);
}
AppUtil.sync(function (err) {
if (err) {
console.log(err);
}
});
} catch (err) {
console.log(err);
Meteor.setTimeout(startSyncingAppState, 2000);
}
});
Meteor.setTimeout(startSyncingAppState, 2000);
};