diff --git a/routes/worker_collection.js b/routes/worker_collection.js index 7d424aa..e0b4b5b 100644 --- a/routes/worker_collection.js +++ b/routes/worker_collection.js @@ -105,9 +105,9 @@ var Worker = (function(){ }; proto.startRunners = function(args){ - console.log('Starting runners on', args.worker.name, args.worker.ip); - var worker = this; + + console.log('Starting runners on', worker.name, worker.ip); // dont make runners on out dated workers if(!worker || worker.settings.image > worker.image.id){ console.log(`Blocked outdated worker(${worker.image.id}), current image ${args.settings.image}.`) @@ -354,7 +354,7 @@ var WorkerCollection = (function(){ // if there are workers being created, stop scale up and down check var skipBalance = workers.currentCreating + workers.length >= workers.settings.min - if(skipBalance || workers.currentCreating){ + if(workers.currentCreating && skipBalance){ return console.log(`Killing balance, workers are being created.`); } diff --git a/testAPI.js b/testAPI.js index 91ff8f8..30b62cd 100644 --- a/testAPI.js +++ b/testAPI.js @@ -63,4 +63,4 @@ let __do = function(till){ setTimeout(__do, 1500, --till); }; -__do(500); +__do(1000);