From 16b79d3aeb2e41e5c5b0a8068afafca31ea1f054 Mon Sep 17 00:00:00 2001 From: vmarchaud Date: Thu, 29 Jun 2017 12:08:09 +0200 Subject: [PATCH] (god) launch one by one to avoid race condition #2984 --- lib/God.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/God.js b/lib/God.js index 4fe23fb8..cc840e7f 100644 --- a/lib/God.js +++ b/lib/God.js @@ -405,14 +405,15 @@ God.prepare = function prepare (env, cb) { env.instances = 1; } - async.times(env.instances, function (n, next) { + async.timesLimit(env.instances, 1, function (n, next) { env.vizion_running = false; if (env.env && env.env.vizion_running) { env.env.vizion_running = false; } - God.injectVariables(env, function inject (_err, proc) { - return God.executeApp(Utility.clone(proc), function (err, clu) { + God.injectVariables(env, function inject (err, _env) { + if (err) return next(err); + return God.executeApp(Utility.clone(_env), function (err, clu) { if (err) return next(err); God.notify('start', clu, true); // here call next wihtout an array because