mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-22 19:02:10 +00:00
fix: random exit from worker making server not react (#685)
This commit is contained in:
parent
16caf3384e
commit
c3cfb2607a
@ -27,15 +27,16 @@ if (cluster.isPrimary) {
|
|||||||
// create the workers
|
// create the workers
|
||||||
console.log(`creating ${maxWorkers} workers...`)
|
console.log(`creating ${maxWorkers} workers...`)
|
||||||
for (let i = 0; i < maxWorkers; i++) {
|
for (let i = 0; i < maxWorkers; i++) {
|
||||||
cluster.fork();
|
cluster.fork()
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster.on('online', (worker) => {
|
cluster.on('online', (worker) => {
|
||||||
console.log('Worker', worker.id, 'online')
|
console.log('Worker', worker.id, 'online')
|
||||||
})
|
})
|
||||||
|
|
||||||
cluster.on("exit", (worker, code, _signal) => {
|
cluster.on("exit", (worker, code, signal) => {
|
||||||
console.log(`Worker ${worker.id} exited with code ${code}`);
|
console.log(`Worker ${worker.id} exited with code ${code} and signal ${signal}`);
|
||||||
|
cluster.fork()
|
||||||
})
|
})
|
||||||
console.log('🚀 Server ready at localhost:3000');
|
console.log('🚀 Server ready at localhost:3000');
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user