only scale back containers on infra change
This commit is contained in:
+11
-9
@@ -26,8 +26,6 @@ var addons = require('./addons.js'),
|
||||
tasks = require('./tasks.js'),
|
||||
_ = require('underscore');
|
||||
|
||||
var NOOP_CALLBACK = function (error) { if (error) debug(error); };
|
||||
|
||||
function start(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
@@ -45,7 +43,7 @@ function start(callback) {
|
||||
if (_.isEqual(infra, existingInfra)) {
|
||||
debug('platform is uptodate at version %s', infra.version);
|
||||
|
||||
onPlatformReady();
|
||||
onPlatformReady(false /* !infraChanged */);
|
||||
|
||||
return callback();
|
||||
}
|
||||
@@ -67,7 +65,7 @@ function start(callback) {
|
||||
|
||||
locker.unlock(locker.OP_PLATFORM_START);
|
||||
|
||||
onPlatformReady();
|
||||
onPlatformReady(true /* infraChanged */);
|
||||
|
||||
callback();
|
||||
});
|
||||
@@ -77,14 +75,18 @@ function stopAllTasks(callback) {
|
||||
tasks.stopAllTasks(callback);
|
||||
}
|
||||
|
||||
function onPlatformReady() {
|
||||
debug('onPlatformReady: platform is ready');
|
||||
function onPlatformReady(infraChanged) {
|
||||
debug(`onPlatformReady: platform is ready. infra changed: ${infraChanged}`);
|
||||
exports._isReady = true;
|
||||
|
||||
apps.schedulePendingTasks(NOOP_CALLBACK);
|
||||
let tasks = [ apps.schedulePendingTasks ];
|
||||
if (infraChanged) tasks.push(applyPlatformConfig, pruneInfraImages);
|
||||
|
||||
applyPlatformConfig(NOOP_CALLBACK);
|
||||
pruneInfraImages(NOOP_CALLBACK);
|
||||
async.series(async.reflectAll(tasks), function (error, results) {
|
||||
results.forEach((result, idx) => {
|
||||
if (result.error) debug(`Startup task at index ${idx} failed: ${result.error.message}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function applyPlatformConfig(callback) {
|
||||
|
||||
Reference in New Issue
Block a user