From 36db6be4bc5458a1b88c2958fcb4b2380621808f Mon Sep 17 00:00:00 2001 From: Thomas Harvey Date: Wed, 18 Oct 2017 00:59:47 -0400 Subject: [PATCH] Adding some logging." --- routes/worker_collection.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routes/worker_collection.js b/routes/worker_collection.js index 6f71e29..fac83b9 100644 --- a/routes/worker_collection.js +++ b/routes/worker_collection.js @@ -144,9 +144,10 @@ var Worker = (function(){ }); }; - proto.sync = function(){ + proto.sync = function(callback){ var worker = this; worker.isSyncing = true; + callback = callback || __empty; // this will call the droplet or the droplet will send the data using a cron job // mainly to update the active runners on the worker @@ -180,6 +181,8 @@ var Worker = (function(){ info.push(mapOut); } + console.log(`RUNNERS FOUND[=> ${worker.ip}`); + console.log(`RUNNERS FOUND[=> ${info}`); worker.availrunners = []; for (let idx = 0, stop = runners.length; idx < stop; idx++){ @@ -193,6 +196,8 @@ var Worker = (function(){ } } worker.isBuildingRunners = false; + console.log(`RUNNERS AVAILABLE[=> ${worker.availrunners}`); + callback(worker); } }); }; @@ -245,8 +250,7 @@ var Worker = (function(){ // Just send the job over and set a timeout // to wait before checking runners setTimeout(function(){ - worker.sync(); - args.callback(worker); + worker.sync(args.callback); }, 10000); });