b9cb6d1c10
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
20 lines
378 B
TypeScript
20 lines
378 B
TypeScript
import * as cluster from 'cluster';
|
|
import { initDb } from '../db/postgre.js';
|
|
|
|
/**
|
|
* Init worker process
|
|
*/
|
|
export async function workerMain() {
|
|
await initDb();
|
|
|
|
// start server
|
|
await require('../server').default();
|
|
|
|
// start job queue
|
|
require('../queue').default();
|
|
|
|
if (cluster.isWorker) {
|
|
// Send a 'ready' message to parent process
|
|
process.send!('ready');
|
|
}
|
|
}
|