blob: 8038e25631f8d71cda5195a563a1d2394749cc0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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');
}
}
|