aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-04-26 11:06:54 +0100
committerMohamedBassem <me@mbassem.com>2024-04-26 11:06:54 +0100
commita91aff23eaa3616aec331ef0267863ed0b0e594b (patch)
tree09a449ec43b632762af1ef7125cf707b8fe45d81 /apps
parent9dace185acff4002aec8265fc010db49d91c7d7f (diff)
downloadkarakeep-a91aff23eaa3616aec331ef0267863ed0b0e594b.tar.zst
feature(crawler): Allow increasing crawler concurrency and configure storing images and screenshots
Diffstat (limited to 'apps')
-rw-r--r--apps/workers/crawlerWorker.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/workers/crawlerWorker.ts b/apps/workers/crawlerWorker.ts
index b583864d..6b4d39f0 100644
--- a/apps/workers/crawlerWorker.ts
+++ b/apps/workers/crawlerWorker.ts
@@ -123,6 +123,7 @@ export class CrawlerWorker {
/* timeoutSec */ serverConfig.crawler.jobTimeoutSec,
),
{
+ concurrency: serverConfig.crawler.numWorkers,
connection: queueConnectionDetails,
autorun: false,
},
@@ -282,6 +283,12 @@ async function storeScreenshot(
userId: string,
jobId: string,
) {
+ if (!serverConfig.crawler.storeScreenshot) {
+ logger.info(
+ `[Crawler][${jobId}] Skipping storing the screenshot as per the config.`,
+ );
+ return null;
+ }
const assetId = newAssetId();
await saveAsset({
userId,
@@ -300,6 +307,12 @@ async function downloadAndStoreImage(
userId: string,
jobId: string,
) {
+ if (!serverConfig.crawler.downloadBannerImage) {
+ logger.info(
+ `[Crawler][${jobId}] Skipping downloading the image as per the config.`,
+ );
+ return null;
+ }
try {
logger.info(`[Crawler][${jobId}] Downloading image from "${url}"`);
const response = await fetch(url);