Code cleanup

-Replace tabs with double-spaces
-Betting spacing and lining up of code functions
-Add missing semi-colons
-Remove extra characters and spaces where applicable
-Remove commented-out code fragments
-Add missing 2021 date to LICENSE
-Small touchups and other misc nitpickings
This commit is contained in:
joeuhren
2021-03-17 17:54:09 -06:00
parent 8304eb211d
commit 20c0a382a3
42 changed files with 1001 additions and 860 deletions
+13 -12
View File
@@ -7,37 +7,38 @@ if (cluster.isMaster) {
console.log('Error: unable to create cluster.pid');
process.exit(1);
} else {
console.log('Starting cluster with pid: ' + process.pid);
//ensure workers exit cleanly
console.log('Starting cluster with pid: ' + process.pid);
// ensure workers exit cleanly
process.on('SIGINT', function() {
console.log('Cluster shutting down..');
for (var id in cluster.workers) {
console.log('Worker shutting down (' + id + ')');
cluster.workers[id].kill();
}
// exit the master process
process.exit(0);
});
// Count the machine's CPUs
// count the machine's CPUs
var cpuCount = require('os').cpus().length;
// Create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1) {
// create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1)
cluster.fork();
}
// Listen for dying workers
// listen for dying workers
cluster.on('exit', function (worker, code, signal) {
if (worker['process']['exitCode'] === 0) {
if (worker['process']['exitCode'] === 0)
console.log('Worker shut down.');
} else if ((signal != 'SIGINT') && (worker['process']['exitCode'] !== 0) && (worker.exitedAfterDisconnect !== true)) {
else if ((signal != 'SIGINT') && (worker['process']['exitCode'] !== 0) && (worker.exitedAfterDisconnect !== true)) {
console.log('Cluster restarting...');
cluster.fork();
}
});
}
});
} else {
require('./instance');
}
} else
require('./instance');