lock for platform start, so that apps are not installed in between

This commit is contained in:
Girish Ramakrishnan
2017-11-28 23:18:43 -08:00
parent 693bc094cc
commit 459314df17
2 changed files with 7 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ var apps = require('./apps.js'),
fs = require('fs'),
hat = require('hat'),
infra = require('./infra_version.js'),
locker = require('./locker.js'),
nginx = require('./nginx.js'),
os = require('os'),
paths = require('./paths.js'),
@@ -63,6 +64,9 @@ function start(callback) {
debug('Updating infrastructure from %s to %s', existingInfra.version, infra.version);
var error = locker.lock(locker.OP_PLATFORM_START);
if (error) return callback(error);
async.series([
stopContainers.bind(null, existingInfra),
startAddons.bind(null, existingInfra),
@@ -72,6 +76,8 @@ function start(callback) {
], function (error) {
if (error) return callback(error);
locker.unlock(locker.OP_PLATFORM_START);
emitPlatformReady();
callback();