Skip to content

Commit

Permalink
askForWork() performance over WAN
Browse files Browse the repository at this point in the history
Closes iarna#19
  • Loading branch information
streamcode9 authored and nponeccop committed May 15, 2016
1 parent 8122aee commit 57d912c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var WorkerTask = require('./task-worker');
var ClientTask = require('./task-client');
var emptyFunction = require('emptyfunction');

exports.__construct = function (init) {
exports.__construct = function (init) {
this._workers = {};
this._workersCount = 0;

Expand Down Expand Up @@ -212,10 +212,10 @@ Worker.dispatchWorker = function (job,socket) {
});

task.writer.once('end', function () {
self.endWork(jobid);
if (socket.connected) {
socket.workComplete(jobid,task.lastChunk);
}
self.endWork(jobid);
});
}
else {
Expand All @@ -229,14 +229,14 @@ Worker.dispatchWorker = function (job,socket) {
});

task.writer.once('end', function () {
self.endWork(jobid);
if (socket.connected) {
if (task.lastChunk) addToBuffer(task.lastChunk);
socket.workComplete(jobid,buffer);
}
self.endWork(jobid);
});
}

try {
var handleReturnValue = function (value) {
if (value && value.pipe) {
Expand Down

0 comments on commit 57d912c

Please sign in to comment.