mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
test: fix flaky cluster test on Windows 10
test-cluster-shared-leak was flaky on Windows 10. Remove unnecessary .send() calls and replace with .disconnect() to avoid spurious EPIPE. Fixes: https://github.com/nodejs/node/issues/4887 PR-URL: https://github.com/nodejs/node/pull/4934 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
0c113e8fde
commit
25f8a0d2dc
1 file changed
+3
-10
@@ -17,8 +17,8 @@ if (cluster.isMaster) {
|
||||
worker2 = cluster.fork();
|
||||
worker2.on('online', function() {
|
||||
conn = net.connect(common.PORT, common.mustCall(function() {
|
||||
worker1.send('die');
|
||||
worker2.send('die');
|
||||
worker1.disconnect();
|
||||
worker2.disconnect();
|
||||
}));
|
||||
conn.on('error', function(e) {
|
||||
// ECONNRESET is OK
|
||||
@@ -39,17 +39,10 @@ if (cluster.isMaster) {
|
||||
return;
|
||||
}
|
||||
|
||||
var server = net.createServer(function(c) {
|
||||
const server = net.createServer(function(c) {
|
||||
c.end('bye');
|
||||
});
|
||||
|
||||
server.listen(common.PORT, function() {
|
||||
process.send('listening');
|
||||
});
|
||||
|
||||
process.on('message', function(msg) {
|
||||
if (msg !== 'die') return;
|
||||
server.close(function() {
|
||||
setImmediate(() => process.disconnect());
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user