diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index 746b8533147f54..628b2fcd6a9661 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -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(); } });