summaryrefslogtreecommitdiff
path: root/src/boot/worker.ts
blob: ca3716972a169b293e8c931f273cafad6fa98447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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');
	}
}