aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workers/index.ts
blob: 4db524efc41eaf48a89a2a70e2213d88a848581f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import "dotenv/config";
import { CrawlerWorker } from "./crawlerWorker";
import { OpenAiWorker } from "./openaiWorker";
import { SearchIndexingWorker } from "./searchWorker";
import { shutdownPromise } from "./exit";

async function main() {
  const [crawler, openai, search] = [
    await CrawlerWorker.build(),
    await OpenAiWorker.build(),
    await SearchIndexingWorker.build(),
  ];

  await Promise.any([
    Promise.all([crawler.run(), openai.run(), search.run()]),
    shutdownPromise,
  ]);
}

main();