mirror of https://github.com/docker/docs.git
Fixing sync bug where deleted container would re-appear after deletion
This commit is contained in:
parent
9e3c063fe9
commit
d64e347850
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -221,24 +221,24 @@ updateBoot2DockerUtilization = function (callback) {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
startUpdatingBoot2DockerUtilization = function () {
|
||||
updateBoot2DockerUtilization(function (err) {
|
||||
if (err) {console.log(err);}
|
||||
updateBoot2DockerUtilization(function (err) { if (err) {console.log(err);} });
|
||||
Meteor.setTimeout(startUpdatingBoot2DockerUtilization, 2000);
|
||||
});
|
||||
};
|
||||
|
||||
startSyncingAppState = function () {
|
||||
try {
|
||||
console.log('app');
|
||||
ImageUtil.sync(function (err) {
|
||||
if (err) {throw err;}
|
||||
AppUtil.sync(function (err) {
|
||||
if (err) {throw err;}
|
||||
Meteor.setTimeout(startSyncingAppState, 2000);
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
Meteor.setTimeout(startSyncingAppState, 2000);
|
||||
}
|
||||
AppUtil.sync(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
Meteor.setTimeout(startSyncingAppState, 2000);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue