Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
cluster: don't silently drop messages when the write queue gets big
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Jun 12, 2012
1 parent f482236 commit bb2ce1a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/child_process.js
Expand Up @@ -117,11 +117,6 @@ function setupChannel(target, channel) {

if (!target._channel) throw new Error("channel closed");

// For overflow protection don't write if channel queue is too deep.
if (channel.writeQueueSize > 1024 * 1024) {
return false;
}

var buffer = Buffer(JSON.stringify(message) + '\n');

if (sendHandle && setSimultaneousAccepts) {
Expand All @@ -137,7 +132,8 @@ function setupChannel(target, channel) {

writeReq.oncomplete = nop;

return true;
/* If the master is > 2 read() calls behind, please stop sending. */
return channel.writeQueueSize < (65536 * 2);
};

channel.readStart();
Expand Down

0 comments on commit bb2ce1a

Please sign in to comment.