FoundKey/packages/backend/src/boot/worker.ts
Johann150 37e47a257e
fix lints "import/order" and "import/no-duplicate"
Also simplified some import paths by replacing relative with absolute paths.
2022-08-03 14:05:50 +02:00

20 lines
419 B
TypeScript

import cluster from 'node:cluster';
import { initDb } from '@/db/postgre.js';
/**
* Init worker process
*/
export async function workerMain() {
await initDb();
// start server
await import('../server/index.js').then(x => x.default());
// start job queue
import('../queue/index.js').then(x => x.default());
if (cluster.isWorker) {
// Send a 'ready' message to parent process
process.send!('ready');
}
}