2024-04-15 17:01:47 -04:00
|
|
|
import { Job, Queue } from "bull";
|
|
|
|
|
import {
|
|
|
|
|
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> {
|
|
|
|
|
return await getWebScraperQueue().add(webScraperOptions, {
|
|
|
|
|
...options,
|
2024-07-25 00:14:25 +02:00
|
|
|
jobId,
|
2024-04-15 17:01:47 -04:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|