Skip to content

Commit

Permalink
Don't use global setImmediate
Browse files Browse the repository at this point in the history
It can be modified by test code.
  • Loading branch information
novemberborn committed Aug 16, 2020
1 parent ef74c8b commit ea66e64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ipc-flow-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// minimally supported versions) we need flow control based on `send()`'s return
// value.

const nowAndTimers = require('./now-and-timers');

function controlFlow(channel) {
let sending = false;

Expand All @@ -32,7 +34,7 @@ function controlFlow(channel) {
buffer.push(message);
if (!sending) {
sending = true;
setImmediate(deliverNext);
nowAndTimers.setImmediate(deliverNext);
}
};
}
Expand Down

0 comments on commit ea66e64

Please sign in to comment.