From d13a2e7d2617658d453984465740b33d70971702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Mon, 11 Nov 2024 20:51:29 +0100 Subject: [PATCH] fix(scrapeURL): reduce logs --- .../scraper/scrapeURL/engines/fire-engine/checkStatus.ts | 1 - .../api/src/scraper/scrapeURL/engines/fire-engine/index.ts | 2 +- apps/api/src/scraper/scrapeURL/transformers/index.ts | 7 +++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/api/src/scraper/scrapeURL/engines/fire-engine/checkStatus.ts b/apps/api/src/scraper/scrapeURL/engines/fire-engine/checkStatus.ts index b895b4fb..1f1bcc69 100644 --- a/apps/api/src/scraper/scrapeURL/engines/fire-engine/checkStatus.ts +++ b/apps/api/src/scraper/scrapeURL/engines/fire-engine/checkStatus.ts @@ -87,7 +87,6 @@ export async function fireEngineCheckStatus(logger: Logger, jobId: string): Prom logger.debug("Scrape succeeded!", { jobId }); return successParse.data; } else if (processingParse.success) { - logger.debug("Scrape is still processing", { jobId }); throw new StillProcessingError(jobId); } else if (failedParse.success) { logger.debug("Scrape job failed", { status, jobId }); diff --git a/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts b/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts index abf92fdb..0ea54382 100644 --- a/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts +++ b/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts @@ -40,7 +40,7 @@ async function performFireEngineScrape { + const executions: [string, number][] = []; + for (const transformer of transformerStack) { const _meta = { ...meta, logger: meta.logger.child({ method: "executeTransformers/" + transformer.name }), }; - meta.logger.debug("Executing transformer " + transformer.name + "...", { document }); const start = Date.now(); document = await transformer(_meta, document); - meta.logger.debug("Finished executing transformer " + transformer.name + " (" + (Date.now() - start) + "ms)", { document }); + executions.push([transformer.name, Date.now() - start]); } + meta.logger.debug("Executed transformers.", { executions }); + return document; }