trashposs/packages/backend/src/boot/worker.ts
syuilo 14148f6c4a refactoring
Resolve #7779
2021-11-12 02:02:25 +09:00

21 lines
375 B
TypeScript

import * as cluster from 'cluster';
import { initDb } from '../db/postgre';
/**
* 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');
}
}