| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0b8124f commit c0a42bc
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const http = require('http'); | ||
| 4 | + const cluster = require('cluster'); | ||
| 5 | + | ||
| 6 | + cluster.schedulingPolicy = cluster.SCHED_RR; | ||
| 7 | + | ||
| 8 | + const server = http.createServer(); | ||
| 9 | + | ||
| 10 | + if (cluster.isMaster) { | ||
| 11 | + server.listen(common.PORT); | ||
| 12 | + const worker = cluster.fork(); | ||
| 13 | + worker.on('exit', common.mustCall(() => { | ||
| 14 | + server.close(); | ||
| 15 | + })); | ||
| 16 | + } else { | ||
| 17 | + process.on('uncaughtException', common.mustCall((e) => {})); | ||
| 18 | + server.listen(common.PORT); | ||
| 19 | + server.on('error', common.mustCall((e) => { | ||
| 20 | + cluster.worker.disconnect(); | ||
| 21 | + throw e; | ||
| 22 | + })); | ||
| 23 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments