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) {
|
AppUtil.remove = function (appId) {
|
||||||
var app = Apps.findOne(appId);
|
var app = Apps.findOne(appId);
|
||||||
if (app.docker) {
|
if (app.docker) {
|
||||||
Apps.remove({_id: appId});
|
|
||||||
Docker.removeContainer(app.docker.Id, function (err) {
|
Docker.removeContainer(app.docker.Id, function (err) {
|
||||||
var appPath = path.join(Util.KITE_PATH, app.name);
|
var appPath = path.join(Util.KITE_PATH, app.name);
|
||||||
Util.deleteFolder(appPath);
|
Util.deleteFolder(appPath);
|
||||||
|
Apps.remove({_id: appId});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Apps.remove({_id: appId});
|
Apps.remove({_id: appId});
|
||||||
|
@ -153,7 +153,7 @@ AppUtil.sync = function (callback) {
|
||||||
var diffApps = _.difference(guiIds, containerIds);
|
var diffApps = _.difference(guiIds, containerIds);
|
||||||
_.each(diffApps, function (appContainerId) {
|
_.each(diffApps, function (appContainerId) {
|
||||||
var app = Apps.findOne({'docker.Id': appContainerId});
|
var app = Apps.findOne({'docker.Id': appContainerId});
|
||||||
if (app) {
|
if (app && app.status !== 'STARTING') {
|
||||||
AppUtil.remove(app._id);
|
AppUtil.remove(app._id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -221,24 +221,24 @@ updateBoot2DockerUtilization = function (callback) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
startUpdatingBoot2DockerUtilization = function () {
|
startUpdatingBoot2DockerUtilization = function () {
|
||||||
updateBoot2DockerUtilization(function (err) {
|
updateBoot2DockerUtilization(function (err) { if (err) {console.log(err);} });
|
||||||
if (err) {console.log(err);}
|
Meteor.setTimeout(startUpdatingBoot2DockerUtilization, 2000);
|
||||||
Meteor.setTimeout(startUpdatingBoot2DockerUtilization, 2000);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
startSyncingAppState = function () {
|
startSyncingAppState = function () {
|
||||||
try {
|
console.log('app');
|
||||||
ImageUtil.sync(function (err) {
|
ImageUtil.sync(function (err) {
|
||||||
if (err) {throw err;}
|
if (err) {
|
||||||
AppUtil.sync(function (err) {
|
console.log(err);
|
||||||
if (err) {throw err;}
|
}
|
||||||
Meteor.setTimeout(startSyncingAppState, 2000);
|
AppUtil.sync(function (err) {
|
||||||
});
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
});
|
||||||
console.log(err);
|
Meteor.setTimeout(startSyncingAppState, 2000);
|
||||||
Meteor.setTimeout(startSyncingAppState, 2000);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue