Skip to content

Commit 8745cb4

Browse files
committed
Update server.js
Automatically restart workers after a 1 sec delay
1 parent addc4ad commit 8745cb4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

example/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if (cluster.isPrimary) {
2424
console.log(
2525
`worker ${worker.process.pid} died with code ${code} from signal ${signal}.`,
2626
)
27+
setTimeout(() => cluster.fork(), 1000) // Wait a second, then start a new worker
2728
})
2829
} else {
2930
// Worker

0 commit comments

Comments
 (0)