Skip to content

Commit ea66e64

Browse files
committed
Don't use global setImmediate
It can be modified by test code.
1 parent ef74c8b commit ea66e64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/ipc-flow-control.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// minimally supported versions) we need flow control based on `send()`'s return
88
// value.
99

10+
const nowAndTimers = require('./now-and-timers');
11+
1012
function controlFlow(channel) {
1113
let sending = false;
1214

@@ -32,7 +34,7 @@ function controlFlow(channel) {
3234
buffer.push(message);
3335
if (!sending) {
3436
sending = true;
35-
setImmediate(deliverNext);
37+
nowAndTimers.setImmediate(deliverNext);
3638
}
3739
};
3840
}

0 commit comments

Comments
 (0)