1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 02:42:09 +00:00

fix: random exit from worker making server not react (#685)

This commit is contained in:
Florian Bouillon 2025-03-12 08:10:49 +01:00 committed by GitHub
parent 16caf3384e
commit c3cfb2607a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,15 +27,16 @@ if (cluster.isPrimary) {
// create the workers
console.log(`creating ${maxWorkers} workers...`)
for (let i = 0; i < maxWorkers; i++) {
cluster.fork();
cluster.fork()
}
cluster.on('online', (worker) => {
console.log('Worker', worker.id, 'online')
})
cluster.on("exit", (worker, code, _signal) => {
console.log(`Worker ${worker.id} exited with code ${code}`);
cluster.on("exit", (worker, code, signal) => {
console.log(`Worker ${worker.id} exited with code ${code} and signal ${signal}`);
cluster.fork()
})
console.log('🚀 Server ready at localhost:3000');
} else {