diff options
| author | MohamedBassem <me@mbassem.com> | 2024-02-06 18:16:35 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-02-06 19:24:52 +0000 |
| commit | baf48af5f0a4b88642edc18ae8b16e81260e1846 (patch) | |
| tree | 1f9779ac76b21ba7504ec664f05064d1b4e9ff2a /shared/queues.ts | |
| parent | e035c2fd1067a06d4774c64ae54548f664490f9d (diff) | |
| download | karakeep-baf48af5f0a4b88642edc18ae8b16e81260e1846.tar.zst | |
Implement metadata fetching logic in the crawler
Diffstat (limited to 'shared/queues.ts')
| -rw-r--r-- | shared/queues.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/shared/queues.ts b/shared/queues.ts index 4303eaa2..ac5acc57 100644 --- a/shared/queues.ts +++ b/shared/queues.ts @@ -1,10 +1,18 @@ import { Queue } from "bullmq"; +import { z } from "zod"; export const queueConnectionDetails = { - host: process.env.REDIS_HOST || "localhost", - port: parseInt(process.env.REDIS_PORT || "6379"), + host: process.env.REDIS_HOST || "localhost", + port: parseInt(process.env.REDIS_PORT || "6379"), }; -export const LinkCrawlerQueue = new Queue("link_crawler_queue", { connection: queueConnectionDetails }); - +export const zCrawlLinkRequestSchema = z.object({ + linkId: z.string(), + url: z.string().url(), +}); +export type ZCrawlLinkRequest = z.infer<typeof zCrawlLinkRequestSchema>; +export const LinkCrawlerQueue = new Queue<ZCrawlLinkRequest, void>( + "link_crawler_queue", + { connection: queueConnectionDetails }, +); |
