From 91784cd20cc218568adb45c7903902ca75ff531a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 9 Dec 2025 22:54:55 +0000 Subject: feat: make asset preprocessing worker timeout configurable - Added ASSET_PREPROCESSING_JOB_TIMEOUT_SEC environment variable with default of 60 seconds (increased from hardcoded 30 seconds) - Updated worker to use the configurable timeout from serverConfig - Added documentation for the new configuration option --- apps/workers/workers/assetPreprocessingWorker.ts | 2 +- docs/docs/03-configuration.md | 1 + packages/shared/config.ts | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/workers/workers/assetPreprocessingWorker.ts b/apps/workers/workers/assetPreprocessingWorker.ts index ff16906d..b585a15e 100644 --- a/apps/workers/workers/assetPreprocessingWorker.ts +++ b/apps/workers/workers/assetPreprocessingWorker.ts @@ -62,7 +62,7 @@ export class AssetPreprocessingWorker { { concurrency: serverConfig.assetPreprocessing.numWorkers, pollIntervalMs: 1000, - timeoutSecs: 30, + timeoutSecs: serverConfig.assetPreprocessing.jobTimeoutSec, }, ); diff --git a/docs/docs/03-configuration.md b/docs/docs/03-configuration.md index 0975f1a7..b89460e6 100644 --- a/docs/docs/03-configuration.md +++ b/docs/docs/03-configuration.md @@ -27,6 +27,7 @@ The app is mainly configured by environment variables. All the used environment | SEARCH_JOB_TIMEOUT_SEC | No | 30 | How long to wait for a search indexing job to finish before timing out. Increase this if you have large bookmarks with extensive content that takes longer to index. | | WEBHOOK_NUM_WORKERS | No | 1 | Number of concurrent workers for webhook delivery. Increase this if you have multiple webhook endpoints or high webhook traffic. | | ASSET_PREPROCESSING_NUM_WORKERS | No | 1 | Number of concurrent workers for asset preprocessing tasks (image processing, OCR, etc.). Increase this if you have many images or documents that need processing. | +| ASSET_PREPROCESSING_JOB_TIMEOUT_SEC | No | 60 | How long to wait for an asset preprocessing job to finish before timing out. Increase this if you have large images or PDFs that take longer to process. | | RULE_ENGINE_NUM_WORKERS | No | 1 | Number of concurrent workers for rule engine processing. Increase this if you have complex automation rules that need to be processed quickly. | ## Asset Storage diff --git a/packages/shared/config.ts b/packages/shared/config.ts index 60beae1e..1bc8f19d 100644 --- a/packages/shared/config.ts +++ b/packages/shared/config.ts @@ -93,6 +93,7 @@ const allEnv = z.object({ SEARCH_JOB_TIMEOUT_SEC: z.coerce.number().default(30), WEBHOOK_NUM_WORKERS: z.coerce.number().default(1), ASSET_PREPROCESSING_NUM_WORKERS: z.coerce.number().default(1), + ASSET_PREPROCESSING_JOB_TIMEOUT_SEC: z.coerce.number().default(60), RULE_ENGINE_NUM_WORKERS: z.coerce.number().default(1), CRAWLER_DOWNLOAD_BANNER_IMAGE: stringBool("true"), CRAWLER_STORE_SCREENSHOT: stringBool("true"), @@ -353,6 +354,7 @@ const serverConfigSchema = allEnv.transform((val, ctx) => { allowedInternalHostnames: val.CRAWLER_ALLOWED_INTERNAL_HOSTNAMES, assetPreprocessing: { numWorkers: val.ASSET_PREPROCESSING_NUM_WORKERS, + jobTimeoutSec: val.ASSET_PREPROCESSING_JOB_TIMEOUT_SEC, }, ruleEngine: { numWorkers: val.RULE_ENGINE_NUM_WORKERS, -- cgit v1.2.3-70-g09d2