Move function out of if block. Fixes #140

This commit is contained in:
copy 2017-03-20 10:52:42 -05:00
parent ba33e5c51a
commit 7fa7bbcb12

View file

@ -63,6 +63,18 @@ function screen_to_text(s)
return result.join("\n");
}
function send_work_to_worker(worker, message)
{
if(current_test < tests.length)
{
worker.send(tests[current_test]);
current_test++;
}
else
{
worker.disconnect();
}
}
if(cluster.isMaster)
{
@ -191,19 +203,6 @@ if(cluster.isMaster)
var current_test = 0;
function send_work_to_worker(worker, message)
{
if(current_test < tests.length)
{
worker.send(tests[current_test]);
current_test++;
}
else
{
worker.disconnect();
}
}
for(var i = 0; i < nr_of_cpus; i++)
{
var worker = cluster.fork();