Commit b5471d2d authored by nilanjandaw's avatar nilanjandaw

minor bug fixes

parent fb183429
...@@ -153,7 +153,7 @@ function dispatch() { ...@@ -153,7 +153,7 @@ function dispatch() {
} }
function getAddress() { function getAddress() {
return items[Math.floor(Math.random() * items.length)]; return workerNodes[Math.floor(Math.random() * workerNodes.length)];
} }
...@@ -170,8 +170,8 @@ client.on('message', function (topic, message) { ...@@ -170,8 +170,8 @@ client.on('message', function (topic, message) {
db.delete(message.function_id) db.delete(message.function_id)
} else if (topic === "heartbeat") { } else if (topic === "heartbeat") {
message = JSON.parse(message) message = JSON.parse(message)
if (workerNodes.indexOf(newItem) === -1) if (workerNodes.indexOf(message.address) === -1)
workerNodes.push(newItem) workerNodes.push(message.address)
console.log(workerNodes); console.log(workerNodes);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment