use docker.restart instead of start/stop since it is atomic

This commit is contained in:
Girish Ramakrishnan
2020-05-18 13:35:42 -07:00
parent b7baab2d0f
commit 9569e46ff8

View File

@@ -269,17 +269,14 @@ function restartContainer(name, callback) {
assert.strictEqual(typeof name, 'string');
assert.strictEqual(typeof callback, 'function');
docker.stopContainer(name, function (error) {
docker.restartContainer(name, function (error) {
if (error && error.reason === BoxError.NOT_FOUND) {
callback(null); // callback early since rebuilding takes long
return rebuildService(name, function (error) { if (error) console.error(`Unable to rebuild service ${name}`, error); });
}
if (error) return callback(error);
docker.startContainer(name, function (error) {
if (error && error.reason === BoxError.NOT_FOUND) {
callback(null); // callback early since rebuilding takes long
return rebuildService(name, function (error) { if (error) console.error(`Unable to rebuild service ${name}`, error); });
}
callback(error);
});
callback(error);
});
}