mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: ensure that all worker servers are ready
Wait for the `'listening'` message from all workers before creating the first connection. This fixes an `EMFILE` error that is raised on Windows when running the following command ``` python tools/test.py -J --repeat=1000 parallel/test-tls-ticket-cluster ``` PR-URL: https://github.com/nodejs/node/pull/52563 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
@@ -33,10 +33,10 @@ const workerCount = 4;
|
||||
const expectedReqCount = 16;
|
||||
|
||||
if (cluster.isPrimary) {
|
||||
let listeningCount = 0;
|
||||
let reusedCount = 0;
|
||||
let reqCount = 0;
|
||||
let lastSession = null;
|
||||
let shootOnce = false;
|
||||
let workerPort = null;
|
||||
|
||||
function shoot() {
|
||||
@@ -73,9 +73,8 @@ if (cluster.isPrimary) {
|
||||
console.error('[primary] got %j', msg);
|
||||
if (msg === 'reused') {
|
||||
++reusedCount;
|
||||
} else if (msg === 'listening' && !shootOnce) {
|
||||
workerPort = port || workerPort;
|
||||
shootOnce = true;
|
||||
} else if (msg === 'listening' && ++listeningCount === workerCount) {
|
||||
workerPort = port;
|
||||
shoot();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user