This commit is contained in:
William Mantly 2016-05-30 17:10:32 -04:00
parent a77d00aab4
commit 421a8ec78b

View File

@ -28,7 +28,7 @@ var workers = (function(){
console.log('Droplet is now active, starting runners in 20 seconds') console.log('Droplet is now active, starting runners in 20 seconds')
setTimeout(function(worker){ setTimeout(function(worker){
console.log('Ready to start runners!') console.log('Ready to start runners!')
workers.startRunners(worker, true) workers.startRunners(workers.makeWorkerObj(worker), true)
isCheckingWorkers = false; isCheckingWorkers = false;
}, 20000, worker); }, 20000, worker);
return true; return true;
@ -84,7 +84,6 @@ var workers = (function(){
workers.destroyOld = function(){ workers.destroyOld = function(){
doapi.dropletsByTag('clworker', function(data){ doapi.dropletsByTag('clworker', function(data){
data = JSON.parse(data); data = JSON.parse(data);
console.log('dropletsByTag data:',data);
data['droplets'].forEach(function(worker){ data['droplets'].forEach(function(worker){
console.log('found old droplet, killing it'); console.log('found old droplet, killing it');
doapi.dropletDestroy(worker.id, function(){}); doapi.dropletDestroy(worker.id, function(){});
@ -103,7 +102,7 @@ var workers = (function(){
return lxc.startEphemeral(name, 'crunner0', worker.ip, function(data){ return lxc.startEphemeral(name, 'crunner0', worker.ip, function(data){
if(!data.ip) return setTimeout(workers.startRunners(worker, newWorker),0); if(!data.ip) return setTimeout(workers.startRunners(worker, newWorker),0);
console.log('started runner') console.log('started runner')
if(newWorker) worker = workers[workers.push(workers.makeWorkerObj(worker))-1] if(newWorker) worker = workers[workers.push(worker)-1]
worker.availrunners.push({ worker.availrunners.push({
ip: data.ip, ip: data.ip,