Files
firecrawl/apps/api/src/services/queue-jobs.ts
T

31 lines
690 B
TypeScript
Raw Normal View History

2024-07-30 13:27:23 -04:00
import { Job, Queue } from "bullmq";
2024-04-15 17:01:47 -04:00
import {
2024-07-30 14:44:13 -04:00
getScrapeQueue,
2024-04-15 17:01:47 -04:00
getWebScraperQueue,
} from "./queue-service";
import { v4 as uuidv4 } from "uuid";
import { WebScraperOptions } from "../types";
export async function addWebScraperJob(
webScraperOptions: WebScraperOptions,
2024-07-25 00:14:25 +02:00
options: any = {},
jobId: string = uuidv4(),
2024-04-15 17:01:47 -04:00
): Promise<Job> {
2024-07-30 13:27:23 -04:00
return await getWebScraperQueue().add(jobId, webScraperOptions, {
2024-04-15 17:01:47 -04:00
...options,
2024-07-25 00:14:25 +02:00
jobId,
2024-04-15 17:01:47 -04:00
});
}
2024-07-30 14:44:13 -04:00
export async function addScrapeJob(
webScraperOptions: WebScraperOptions,
options: any = {},
jobId: string = uuidv4(),
): Promise<Job> {
return await getScrapeQueue().add(jobId, webScraperOptions, {
...options,
jobId,
});
}