fix(batch/scrape/webhook): add batch_scrape.started
This commit is contained in:
@@ -16,6 +16,7 @@ import { logCrawl } from "../../services/logging/crawl_log";
|
|||||||
import { getScrapeQueue } from "../../services/queue-service";
|
import { getScrapeQueue } from "../../services/queue-service";
|
||||||
import { getJobPriority } from "../../lib/job-priority";
|
import { getJobPriority } from "../../lib/job-priority";
|
||||||
import { addScrapeJobs } from "../../services/queue-jobs";
|
import { addScrapeJobs } from "../../services/queue-jobs";
|
||||||
|
import { callWebhook } from "../../services/webhook";
|
||||||
|
|
||||||
export async function batchScrapeController(
|
export async function batchScrapeController(
|
||||||
req: RequestWithAuth<{}, CrawlResponse, BatchScrapeRequest>,
|
req: RequestWithAuth<{}, CrawlResponse, BatchScrapeRequest>,
|
||||||
@@ -86,6 +87,10 @@ export async function batchScrapeController(
|
|||||||
);
|
);
|
||||||
await addScrapeJobs(jobs);
|
await addScrapeJobs(jobs);
|
||||||
|
|
||||||
|
if(req.body.webhook) {
|
||||||
|
await callWebhook(req.auth.team_id, id, null, req.body.webhook, true, "batch_scrape.started");
|
||||||
|
}
|
||||||
|
|
||||||
const protocol = process.env.ENV === "local" ? req.protocol : "https";
|
const protocol = process.env.ENV === "local" ? req.protocol : "https";
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
|
|||||||
@@ -166,4 +166,4 @@ export type PlanType =
|
|||||||
| "";
|
| "";
|
||||||
|
|
||||||
|
|
||||||
export type WebhookEventType = "crawl.page" | "batch_scrape.page" | "crawl.started" | "crawl.completed" | "batch_scrape.completed" | "crawl.failed";
|
export type WebhookEventType = "crawl.page" | "batch_scrape.page" | "crawl.started" | "batch_scrape.started" | "crawl.completed" | "batch_scrape.completed" | "crawl.failed";
|
||||||
Reference in New Issue
Block a user