Skip to content

Commit f8d63bd

Browse files
committed
chore(worker): correct stall recovery comments
1 parent 825ccd2 commit f8d63bd

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

apps/worker/src/env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export const env = createEnv({
2626
// otherwise BullMQ would treat the job as stalled and reprocess it (double
2727
// send). Validated so a bad value can't become NaN (= wait forever). Since
2828
// the coexist split (heavy worker), this max (9 min) is the ONLY reason the
29-
// integration worker's lockDuration/stalledInterval stay at 10 min — see
29+
// integration worker's lockDuration stays at 10 min (its stalledInterval
30+
// reverted to the BullMQ default) — see
3031
// `apps/worker/src/integration/worker.ts`.
3132
CHAT_JOB_WAIT_TIMEOUT_MS: z.coerce
3233
.number()

apps/worker/src/integration/worker.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,12 @@ async function startIntegrationWorker() {
367367
// the max wait to tighten this lock (see plan §7, out of scope here).
368368
lockDuration: 10 * 60 * 1000,
369369
// No stalledInterval override: with coexist gone there are no
370-
// long-running jobs here, so the BullMQ default (30s) applies — a
371-
// crashed worker's jobs are re-picked in seconds instead of minutes.
372-
// Live workers auto-renew their locks, so the frequent check cannot
373-
// false-positive an in-progress job.
370+
// long-running jobs here, so the BullMQ default (30s) applies. A
371+
// crashed worker's job is reclaimed once its lock EXPIRES and the next
372+
// scan runs — ~10–10.5 min after the crash (lock expiry + ≤30s scan),
373+
// down from ~10–20 min with the old 10-min scan interval. Live workers
374+
// auto-renew their locks (including through awaitChatJob waits), so the
375+
// frequent check cannot false-positive an in-progress job.
374376
maxStalledCount: 1,
375377
},
376378
)

0 commit comments

Comments
 (0)