diff options
| author | Claude <noreply@anthropic.com> | 2025-12-09 22:54:55 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-12-10 08:23:43 +0000 |
| commit | 91784cd20cc218568adb45c7903902ca75ff531a (patch) | |
| tree | c0536ec7b1ebc4031b16a91f13fa4da555dbcb3f | |
| parent | 3e8cc745dd692e47784e68f209a70137ec9d86fe (diff) | |
| download | karakeep-91784cd20cc218568adb45c7903902ca75ff531a.tar.zst | |
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
| -rw-r--r-- | apps/workers/workers/assetPreprocessingWorker.ts | 2 | ||||
| -rw-r--r-- | docs/docs/03-configuration.md | 1 | ||||
| -rw-r--r-- | packages/shared/config.ts | 2 |
3 files changed, 4 insertions, 1 deletions
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, |
