From ebf98e3c16651c8ae5efd24af39bbee63388f66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Tue, 1 Jul 2025 16:27:38 +0200 Subject: [PATCH] feat(queue-worker): decrease job lock duration to pick up jobs on dead workers faster (#1737) --- apps/api/src/services/queue-worker.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/api/src/services/queue-worker.ts b/apps/api/src/services/queue-worker.ts index 9eb4cd0f..c8aacdba 100644 --- a/apps/api/src/services/queue-worker.ts +++ b/apps/api/src/services/queue-worker.ts @@ -96,7 +96,7 @@ const workerLockDuration = Number(process.env.WORKER_LOCK_DURATION) || 60000; const workerStalledCheckInterval = Number(process.env.WORKER_STALLED_CHECK_INTERVAL) || 30000; const jobLockExtendInterval = - Number(process.env.JOB_LOCK_EXTEND_INTERVAL) || 15000; + Number(process.env.JOB_LOCK_EXTEND_INTERVAL) || 10000; const jobLockExtensionTime = Number(process.env.JOB_LOCK_EXTENSION_TIME) || 60000; @@ -717,8 +717,7 @@ const workerFun = async ( const worker = new Worker(queue.name, null, { connection: redisConnection, - lockDuration: 1 * 60 * 1000, // 1 minute - // lockRenewTime: 15 * 1000, // 15 seconds + lockDuration: 30 * 1000, // 30 seconds stalledInterval: 30 * 1000, // 30 seconds maxStalledCount: 10, // 10 times });