This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

cluster: don't silently drop messages when the write queue gets big

  • Loading branch information...
1 parent f482236 commit bb2ce1a108b3c852a413c641bd021c9c25598d34 @piscisaureus piscisaureus committed Jun 11, 2012
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/child_process.js
View
@@ -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) {
@@ -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();

0 comments on commit bb2ce1a

Please sign in to comment.