All files / src/config workerOptions.ts

100% Statements 19/19
75% Branches 3/4
100% Functions 0/0
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 192x 2x 2x 2x 2x 2x 2x 2x 20x 65x 2x 2x 2x 2x 2x 2x 2x 2x  
import { WorkerOptions } from 'bullmq';
 
/**
 * Standard worker options for stall detection and recovery.
 * Defined in ADR-053.
 *
 * Note: This is a partial configuration that must be spread into a full
 * WorkerOptions object along with a `connection` property when creating workers.
 */
export const defaultWorkerOptions: Omit<WorkerOptions, 'connection'> = {
  // Check for stalled jobs every 30 seconds
  stalledInterval: 30000,
  // Fail job after 3 stalls (prevents infinite loops causing infinite retries)
  maxStalledCount: 3,
  // Duration of the lock for the job in milliseconds.
  // If the worker doesn't renew this (e.g. crash), the job stalls.
  lockDuration: 30000,
};