fix(v1/scrape): add total wait specified in request to timeout
Some checks are pending
Fly Deploy / Pre-deploy checks (push) Waiting to run
Fly Deploy / Deploy app (push) Blocked by required conditions

This commit is contained in:
Gergő Móricz 2024-09-24 21:56:22 +02:00
parent 3f138e559e
commit f00c0b82f9

View File

@ -54,9 +54,11 @@ export async function scrapeController(
jobPriority
);
const totalWait = (req.body.waitFor ?? 0) + (req.body.actions ?? []).reduce((a,x) => (x.type === "wait" ? x.milliseconds : 0) + a, 0);
let doc: any | undefined;
try {
doc = (await waitForJob(job.id, timeout))[0];
doc = (await waitForJob(job.id, timeout + totalWait))[0];
} catch (e) {
Logger.error(`Error in scrapeController: ${e}`);
if (e instanceof Error && e.message.startsWith("Job wait")) {