first commit

This commit is contained in:
编码猿
2024-09-27 01:31:25 +08:00
commit 07c46ac300
558 changed files with 37414 additions and 0 deletions

14
mApi/cluster.js Executable file
View File

@@ -0,0 +1,14 @@
var cluster = require('cluster');
if (cluster.isMaster) {
//Fork a worker to run the main program
for (var i = 0; i < 2; i++) var worker = cluster.fork();
} else {
//Run main program
require('./build/www.js');
console.log('worker is running');
}
cluster.on('death', function(worker) {
console.log('worker ' + worker.pid + ' died. restart...');
cluster.fork();
});