Skip to content

Commit

Permalink
cluster: defer errno propagation to nextTick
Browse files Browse the repository at this point in the history
This change allows to remove the errno message from the read buffer of
the IPC channel in the event an exception is thrown and then catched
when processing the message. Without this change, the message will be
handled multiple times.
  • Loading branch information
santigimeno committed May 20, 2016
1 parent 7c3e920 commit 7dae5d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,9 @@ function workerInit() {
// Round-robin. Master distributes handles across workers.
function rr(message, cb) {
if (message.errno)
return cb(message.errno, null);
return process.nextTick(function() {
cb(message.errno, null);
});

var key = message.key;
function listen(backlog) {
Expand Down

0 comments on commit 7dae5d7

Please sign in to comment.