From 01f60c829d0782a5747870230823a0420313561e Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 28 Jul 2018 17:57:24 +0900 Subject: [PATCH] :v: --- src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3698141e9..41d4d7ce0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,27 +26,28 @@ import { Config } from './config/types'; const clusterLog = debug('misskey:cluster'); const ev = new Xev(); -process.title = 'Misskey'; - if (process.env.NODE_ENV != 'production') { process.env.DEBUG = 'misskey:*'; } const pkg = require('../package.json'); +//#region Command line argument definitions program .version(pkg.version) .option('--no-daemons', 'Disable daemon processes (for debbuging)') .option('--disable-clustering', 'Disable clustering') .parse(process.argv); +//#endregion -// Start app main(); /** * Init process */ function main() { + process.title = `Misskey (${ cluster.isMaster ? 'master' : 'worker' })`; + if (cluster.isMaster || program.disableClustering) { masterMain(); @@ -186,6 +187,8 @@ function spawnWorkers(limit: number) { }); } +//#region Events + // Listen new workers cluster.on('fork', worker => { clusterLog(`Process forked: [${worker.id}]`); @@ -216,3 +219,5 @@ process.on('uncaughtException', err => { process.on('exit', code => { Logger.info(`The process is going to exit with code ${code}`); }); + +//#endregion