summaryrefslogtreecommitdiff
path: root/src/boot/worker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/worker.ts')
-rw-r--r--src/boot/worker.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/boot/worker.ts b/src/boot/worker.ts
new file mode 100644
index 0000000000..362fa3f26b
--- /dev/null
+++ b/src/boot/worker.ts
@@ -0,0 +1,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');
+ }
+}