forked from FoundKeyGang/FoundKey
backend: fix types in boot/{master, worker}.ts
This commit is contained in:
parent
058d414fff
commit
29c7e7e859
2 changed files with 9 additions and 8 deletions
|
@ -32,7 +32,7 @@ function greet(): void {
|
||||||
console.log(themeColor(' | |_|___ ___| |_ ___ _ _ '));
|
console.log(themeColor(' | |_|___ ___| |_ ___ _ _ '));
|
||||||
console.log(themeColor(' | | | | |_ -|_ -| \'_| -_| | |'));
|
console.log(themeColor(' | | | | |_ -|_ -| \'_| -_| | |'));
|
||||||
console.log(themeColor(' |_|_|_|_|___|___|_,_|___|_ |'));
|
console.log(themeColor(' |_|_|_|_|___|___|_,_|___|_ |'));
|
||||||
console.log(' ' + chalk.gray(v) + themeColor(' |___|\n'.substr(v.length)));
|
console.log(' ' + chalk.gray(v) + themeColor(' |___|\n'.slice(v.length)));
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
console.log(' Misskey is an open-source decentralized microblogging platform.');
|
console.log(' Misskey is an open-source decentralized microblogging platform.');
|
||||||
|
@ -61,7 +61,7 @@ export async function masterMain(): Promise<void> {
|
||||||
config = loadConfigBoot();
|
config = loadConfigBoot();
|
||||||
await connectDb();
|
await connectDb();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
bootLogger.error('Fatal error occurred during initialization', null, true);
|
bootLogger.error('Fatal error occurred during initialization', {}, true);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ function showEnvironment(): void {
|
||||||
|
|
||||||
if (env !== 'production') {
|
if (env !== 'production') {
|
||||||
logger.warn('The environment is not in production mode.');
|
logger.warn('The environment is not in production mode.');
|
||||||
logger.warn('DO NOT USE FOR PRODUCTION PURPOSE!', null, true);
|
logger.warn('DO NOT USE FOR PRODUCTION PURPOSE!', {}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +110,9 @@ function loadConfigBoot(): Config {
|
||||||
try {
|
try {
|
||||||
config = loadConfig();
|
config = loadConfig();
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
if (exception.code === 'ENOENT') {
|
const e = exception as Partial<NodeJS.ErrnoException> | Error;
|
||||||
configLogger.error('Configuration file not found', null, true);
|
if ('code' in e && e.code === 'ENOENT') {
|
||||||
|
configLogger.error('Configuration file not found', {}, true);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else if (e instanceof Error) {
|
} else if (e instanceof Error) {
|
||||||
configLogger.error(e.message);
|
configLogger.error(e.message);
|
||||||
|
@ -135,8 +136,8 @@ async function connectDb(): Promise<void> {
|
||||||
const v = await db.query('SHOW server_version').then(x => x[0].server_version);
|
const v = await db.query('SHOW server_version').then(x => x[0].server_version);
|
||||||
dbLogger.succ(`Connected: v${v}`);
|
dbLogger.succ(`Connected: v${v}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dbLogger.error('Cannot connect', null, true);
|
dbLogger.error('Cannot connect', {}, true);
|
||||||
dbLogger.error(e);
|
dbLogger.error(e as Error | string);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,6 @@ export async function workerMain(): Promise<void> {
|
||||||
|
|
||||||
if (cluster.isWorker) {
|
if (cluster.isWorker) {
|
||||||
// Send a 'ready' message to parent process
|
// Send a 'ready' message to parent process
|
||||||
process.send!('ready');
|
process.send?.('ready');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue