cluster.on('listening', function(worker, address) { console.log("A worker with #"+worker.id+" is now connected to " + address.address + ":" + address.port); });
startInClusterMode() { const cpuCount = OS.cpus().length; if (cpuCount < 2) { this.startInStandaloneMode(); } else if (cluster.isMaster) { logger.info(`Launching in cluster mode across ${cpuCount} CPUs`); for (let i = 0; i < cpuCount; i += 1) { cluster.fork(); } cluster.on('exit', (worker) => { logger.info(`Worker ${worker.id} exited. Launching again...`); cluster.fork(); }); cluster.on('listening', (worker, address) => { logger.info(`Worker ${worker.id} is now connected to ${address.address || 'localhost'}:${address.port}`); }); } else { this.startInStandaloneMode(); } }
cluster.on('listening', (worker, address)=> { console.log("A worker is now connected to " + address.address + ":" + address.port); });
cluster.on('listening',(worker,addr)=>{ console.log(`worker${worker.id} listening on ${addr.address}:${addr.port}`) });
cluster.on('listening', (worker, address) => { console.log( `A worker Id ${worker.id} is now connected to ${address.address}:${address.port}`); });
cluster.on('listening',(worker,addr)=>{ console.log(`worker${worker.id} listening on ${addr.address}:${addr.port}`) });