Skip to content

Commit c0a42bc

Browse files
santigimenoMyles Borins
authored and
Myles Borins
committed
test: verify IPC messages are emitted on next tick
The test in this commit runs correctly if IPC messages are properly consumed and emitted. Otherwise, the test times out. Fixes: #6561 PR-URL: #6909 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 0b8124f commit c0a42bc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
const common = require('../common');
3+
const http = require('http');
4+
const cluster = require('cluster');
5+
6+
cluster.schedulingPolicy = cluster.SCHED_RR;
7+
8+
const server = http.createServer();
9+
10+
if (cluster.isMaster) {
11+
server.listen(common.PORT);
12+
const worker = cluster.fork();
13+
worker.on('exit', common.mustCall(() => {
14+
server.close();
15+
}));
16+
} else {
17+
process.on('uncaughtException', common.mustCall((e) => {}));
18+
server.listen(common.PORT);
19+
server.on('error', common.mustCall((e) => {
20+
cluster.worker.disconnect();
21+
throw e;
22+
}));
23+
}

0 commit comments

Comments
 (0)